/*
14core LED Chase Effect with 14Core Stater Kit
*/
byte ledPin[] = {4, 5, 6, 7, 8, 9, 10, 11, 12, 13}; // Define the pins on arduino
int ledDelay(65); // delay changes
int leddirection = 1;
int ledcurrentLED = 0;
unsigned long changeTime;
void setup() {
for (int x=0; x<10; x++) {
pinMode(ledPin[x], OUTPUT); } // set all pins to output
changeTime = millis();
}
void loop() {
if ((millis() - changeTime) > ledDelay) { // if it has been ledDelay ms since last change
changeLED();
changeTime = millis();
}
}
// Increment Function to turn off all LED
void changeLED() {
for (int x=0; x<10; x++) { // Increment x++
digitalWrite(ledPin[x], LOW);
}
digitalWrite(ledPin[ledcurrentLED], HIGH); // Turning on the current LED
ledcurrentLED += leddirection; // increment the direction by value
// changing the direction if we reach the last LED
if (ledcurrentLED == 9) {leddirection = -1;}
if (ledcurrentLED == 0) {leddirection = 1;}
}
code does not work when I compile, something is missing.