Download Name Blinking an LED Blinking an LED Directions: Use page 7 of

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Name mangling wikipedia , lookup

C Sharp syntax wikipedia , lookup

APL syntax and symbols wikipedia , lookup

Tail call wikipedia , lookup

C syntax wikipedia , lookup

One-pass compiler wikipedia , lookup

Subroutine wikipedia , lookup

Standard ML wikipedia , lookup

C++ wikipedia , lookup

Parameter (computer programming) wikipedia , lookup

Transcript
Name _______________________________________________
Blinking an LED
Directions: Use page 7 of the Arduino Programming Notebook to respond to questions 1-3: (copy is in handout folder
and also at this URL) http://playground.arduino.cc/uploads/Main/arduino_notebook_v1-1.pdf
1) Use the table to record information about the two required functions for all Arduino sketches.
Name of Function
What does it do?
When does it execute?
2) Where does this guide suggest you declare your variables?
3) What kind of scope will variables declared this way have? Where will you be able to use them?
BUILDING THE CIRCUIT & CODING THE SKETCH
Directions: Find Circuit #1 in your SIK guide (Blinking an LED). Build the circuit as described in the guide. Please take care
to use the right value resistor and ensure you are noticing which side of the LED is the anode (+ leg) and cathode (leg).
Once you have built your circuit, type in the code for the sketch, verify, and upload it to your RedBoard.
4) Call your teacher over to demonstrate that it works.
5) Take a look at the function call to pinMode(13, OUTPUT);
a) What does it do?
b) Why is it in the setup function?
c) To what does the first parameter (13) correspond in the circuit?
6) Take a look at the function call to digitalWrite
a) What does the first parameter represent?
b) What enumerated constant is sent as the second parameter in order to turn the LED on?
c) What enumerated constant is sent as the second parameter in order to turn the LED off?
7) In what unit of time is the parameter sent to the delay function specified?
8) What is a real-world application of LED’s?
Blinking an LED
9) Create a new sketch called SOS. Write code to send S-O-S in morse code (described here:
http://www.omniglot.com/writing/morsecode.htm). Use the following guidelines:



Dash = 1 second
Dot = 0.5 seconds
Pause for half a second between dashes and dots and two full seconds between letters
Call your teacher over to demonstrate that it works.