// Declare the pins for the LEDs
int ledPins[17] = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11,12,13,14,15,16};
// Declare the variables for the chasing LEDs
int currentLED = 0;
int delayTime = 100;
void setup() {
// Set the pins for the LEDs as outputs
for (int i = 0; i < 17; i++) {
pinMode(ledPins[i], OUTPUT);
}
}
void loop() {
// Turn on the current LED
digitalWrite(ledPins[currentLED], HIGH);
// Delay for a certain amount of time
delay(delayTime);
// Turn off the current LED and turn on the next LED
digitalWrite(ledPins[currentLED], LOW);
currentLED++;
// If we have reached the last LED, start over at the beginning
if (currentLED >= 17) {
currentLED = 0;
}
}
/*****************************************************
********************************************************/
Loading
stm32-bluepill
stm32-bluepill
led chaser by arvind patil.