Back to Parent

// exercise 3
// declare a variable and load it with value
int ledPinRed = D2;
int ledPinBlue = D4;

void setup(){
    // set D2 as output pin
    pinMode(ledPinRed, OUTPUT);
    pinMode(ledPinBlue, OUTPUT);
}      
    
void loop(){
    // switch red it on
    digitalWrite(ledPinRed, HIGH);
    // wait for 1 second
    delay(1000);
    // switch it off
    digitalWrite(ledPinRed, LOW);
    // switch blue on
    digitalWrite(ledPinBlue, HIGH);
    // wait for 1 second
    delay(1000);
    // switch it off
    digitalWrite(ledPinBlue, LOW);
    // code will repeat 
}
Click to Expand

Content Rating

Is this a good/useful/informative piece of content to include in the project? Have your say!

0