Hardware Reference
In-Depth Information
for(int dutyCycle = 3; dutyCycle <= 15; dutyCycle += 3) {
//loopCount = 0;
//timeNow = millis();
//while(millis() timeNow < (displayTime+current*2)) { //// fade
out as
slow as animation has achieved by now
// loopCount++;
if(!(loopCount % dutyCycle)) charlieON(19);
else charlieOFF(19);
// }
}
current = 0;
charlieOFF(19); // Turn off the remaining (possibly) lit LED
delay(50);
////+ random(3000)); // Then rinse, repeat ... after a short pause
}
}
//// ----------------------------------------------------------------
----------------
//// Turns on LED #thisLED. Turns off all LEDs if the value passed is
out of
range.
////
void charlieON(int thisLED) {
//// Turn off previous (reduces overhead, only switch 2 pins
rather than 5)
digitalWrite(charliePin[LED[previous][1]], LOW); //// Ensure in-
ternal pull-ups
aren't engaged on INPUT mode
pinMode(charliePin[LED[previous][0]], INPUT);
pinMode(charliePin[LED[previous][1]], INPUT);
//// Turn on the one that's in focus
if(thisLED >= 0 && thisLED <= 19) {
pinMode(charliePin[LED[thisLED][0]], OUTPUT);
pinMode(charliePin[LED[thisLED][1]], OUTPUT);
digitalWrite(charliePin[LED[thisLED][0]], LOW);
digitalWrite(charliePin[LED[thisLED][1]], HIGH);
}
previous = thisLED;
}
//// ----------------------------------------------------------------
-----------
//// Turns off LED #thisLED.
////
void charlieOFF(int thisLED) {
Search WWH ::




Custom Search