Hardware Reference
In-Depth Information
{ : This begins the set of statements the program will execute if the comparison
statement is true.
digitalWrite(led, HIGH); : The four statements that turn the LED on
and off at a 100 msec rate are delay(100); , digitalWrite(led,
LOW); , delay(100); , and whichLED = 0; .The whichLED variable is as-
signed a value of 0. This will make sure the next time through the loop it will ex-
ecute the else statement.
} : This ends the set of statements that will be executed if the comparison state-
ment is true.
else : This statement, which is optional, defines a statement or set of statements
that should be executed if the comparison statement is false.
{ : This begins the set of statements the program will execute if the comparison
statement returns false.
digitalWrite(led, HIGH); : The four statements that turn the LED on
and off at a 1000 msec rate are delay(1000); , digitalWrite(led,
LOW); , delay(1000); , and whichLED=1; . The whichLED variable is as-
signed a value of 1. This will make sure that next time it will execute the if state-
ment through the loop.
When you have this code typed in, you can upload it. When it is uploaded, you should see
a short flash of the LED, followed by a longer flash, much like a heartbeat.
Search WWH ::




Custom Search