Back to Parent

//exercise 2: blink on and off 5 times then stop for 3 sec

int ledPin = D2;

void setup() {
    
    pinMode (ledPin, OUTPUT);
    
}

void loop(){
    for (int i = 0; i < 5; i++){ //repeat 0.5sec blinking for 5 times
    
    digitalWrite(ledPin, HIGH); 
    delay(500);
    
    digitalWrite(ledPin, LOW);
    delay(500);
    }
    
    digitalWrite(ledPin, LOW); //stop for 3 sec
    delay(3000);
   
   
}
Click to Expand

Content Rating

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

0