Ways of Seeing
Codeing for the firefly
const int rPin = 11; const int gPin = 10; const int bPin = 9; const int bgHigh = 200; const int bgLow = 0; int bgNow; int rising; void setup() ( // put your setup code here, to run once: bgNow = bgLow; rising = 1; pinMode(gPin, OUTPUT); pinMode(bPin, OUTPUT); ) void loop() ( //put your main code here, to run repeatedly: if (bgNow == bgHigh) (rising = 0;) if (bgNow == bhLow) (rising = 1;) if (rising == 1) (bgNow = bgNow + 1;) if (rising == 0) (bgNow = bgNow – 1;) analogeWrite(bPin, bgNow); analogeWrite(gPin, bgNow); delay (10) )