code for LED wave:
void setup() // run once, when the sketch starts
{ // even though there's nothing in it } // we still need this process void loop() // run over and over again
{ for (int ledPin = 13; ledPin >= 4; ledPin--) // Declares ledPin, // tests if equal to or greater than 4 // then does the following. It repeats // but decreases the value of ledPin by 1 { pinMode(ledPin, OUTPUT); // sets the digital pin as output digitalWrite(ledPin, HIGH); // sets the LED-ledPin on delay(75); // waits for 75 milliseconds digitalWrite(ledPin, LOW); // sets the LED-ledPin off } for (int ledPin = 4; ledPin <=13; ledPin++) // Declares ledPin, // tests if equal to or less than 13 // then does the following. It repeats // but increases the value of ledPin by 1 { pinMode(ledPin, OUTPUT); // sets the digital pin as output digitalWrite(ledPin, HIGH); // sets the LED-ledPin on delay(75); // waits for 75 milliseconds digitalWrite(ledPin, LOW); //set the LED-ledPin off } } P.S.
This way is much easier than my previous try. |