Skip to content

Instantly share code, notes, and snippets.

@arielchuri
Created September 30, 2015 14:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arielchuri/ea0b1c0b5629826d3a1e to your computer and use it in GitHub Desktop.
Save arielchuri/ea0b1c0b5629826d3a1e to your computer and use it in GitHub Desktop.
The 100 LEDs without all of the serial printing so you can see how simple it is.
int leds[100];
int ledCount = 100;
int blinkFactor = 1;
void setup() {
Serial.begin(9600);
for (int blinkFactor = 1; blinkFactor <= 100; blinkFactor++) {
for (int thisLed = blinkFactor - 1; thisLed < ledCount; thisLed += blinkFactor) {
if (leds[thisLed] == 0) {
leds[thisLed] = 1;
} else {
leds[thisLed] = 0;
}
}
}
for (int thisLed; thisLed <= ledCount; thisLed++) {
if (leds[thisLed] == 1) {
Serial.print(thisLed + 1);
Serial.print(" ");
}
}
}
void loop() {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment