Go Down

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

forgetcolor

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?

LarryD

The way you have it in your schematic isn't the same as how you have it wired up!

forgetcolor


Go Up