Data Sheet
19 : circuit 1a
CODE TO NOTE
DIGITAL OUTPUT:
digitalWrite(D13, HIGH);
When you’re using a pin as an OUTPUT, you can command it to be
HIGH (output 5 volts) or LOW (output 0 volts).
DELAY:
delay(2000);
Causes the program to wait on this line of code for the amount of
time in between the brackets, represented in milliseconds (2000ms
= 2s). Aer the time has passed, the program will continue to the
next line of code.
COMMENTS:
//This is a comment
/* So is this */
Comments are a great way to leave notes in your code explaining
why you wrote it the way you did. Single line comments use two
forward slashes //, while multi-line comments start with a /* and
end with a */.
NEW IDEAS
CODING CHALLENGES: e Coding Challenges section is where you will nd suggestions for changes
to the circuit or code that will make the circuit more challenging. If you feel underwhelmed by the tasks in each
circuit, visit the Coding Challenges section to push yourself to the next level.
CODING CHALLENGES
PERSISTENCE OF VISION: Computer screens, movies and the lights in your house all icker so
quickly that they appear to be on all of the time but are actually blinking faster than the human eye can detect.
See how much you can decrease the delay time in your program before the light appears to be on all the time
but is still blinking.
MORSE CODE: Try adding and changing the
delay() values and adding more
digitalWrite()
commands to make your program blink a message in Morse code.
TROUBLESHOOTING
I get an error when
uploading my code
e most likely cause is that you have the wrong board selected in the Arduino
IDE. Make sure you have selected Tools > Board > Arduino/Genuino Uno.