Created
October 24, 2018 10:45
-
-
Save pinglunliao/5c33d827df257ff094e86eceeff9cf1a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int sPin = 2; // The base pin ID | |
int nLEDs = 10; // The number of LEDs | |
int delayMS = 100; | |
void setup() | |
{ | |
for (int i = sPin; i < sPin + nLEDs; i++) | |
{ | |
pinMode(i, OUTPUT); | |
} | |
} | |
void loop() | |
{ | |
for(int i = sPin; i < sPin + nLEDs; i++) | |
{ | |
digitalWrite(i, LOW); | |
delay(delayMS); | |
} | |
for(int i = sPin; i < sPin + nLEDs; i++) | |
{ | |
digitalWrite(i, HIGH); | |
delay(delayMS); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment