Go Down

Topic: confused about order of operations in blink demo [solved] (Read 1 time) previous topic - next topic


Jan 09, 2013, 06:29 am Last Edit: Jan 09, 2013, 07:47 am by Nick Gammon Reason: 1
I'm playing with the built-in blink example, and am confused about why things are working as they are.  In the following code snippet:

Code: [Select]
void loop() {
 digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
 delay(1000);               // wait for a second
 digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
 delay(4000);               // wait for a second

I would expect this to light up the LED, wait for 1 sec, then turn it off and wait for 4 sec.  However, the opposite is true.  It lights up, stays lit for 4 seconds, then turns off and waits for 1 second.

I a little bit feel like I'm going crazy here.  Why is it reverse of what I expect?


No technical PMs.
The last thing you did is where you should start looking.


Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131