Arduino Programming and Electronics

Project 1: Blinking light
PURPOSE:
A lot of things you do start with an idea, a lightbulb in your head. You are going to bring out that bulb from your head and show the world you have an idea.
MATERIALS NEEDED:
Arduino board
Arduino USB Cable
Computer
THE PROJECT: (BLINK)
Plug in your arduino and let's start your first program.
1. Double-click the Arduino icon on your desktop.
2. Click on file, Save as , then give it the name Blink.
3. Copy the following that is in red only. (Remember to be exact. Even the smallest mistake might make your program not work). We will break it down in grey (The stuff you don't have to write down ) When you open a new sketch, part of it is already there for you. you can delete it all and start fresh to avoid any confusion.
/* Anything between the symbols /* and */ or anything after the \\ symbol is considered a comment and ignored by the Arduino. You just need it for keeping track of what you do.*/
\\ My Project Name: Blink
\\ What my project does: Makes my idea wink (or blink) at me by turning an light on and off
int led = 13;
//The arduino has a built in LED right on pin 13
\* Here we tell the Arduino that we are going to use pin 13. But instead of calling it 13 every time we are going to call it something we can remember what it was for. Since we are using an LED for that pin(connection) then we call it led . *\
void setup ( ) {
pinMode (led, OUTPUT);
//This is where we tell the Arduino to use pin 13 as an output because we want to see what happens.
} /* END SETUP */
void loop (){
digitalWrite (led, HIGH);
\\Turn the LED ondelay(500);
\\Leave it on for a little bit so we can see what happensdigitalWrite (led, LOW);
\\Turn LED offdelay(500);
\\Wait some time to make sure it turns off}
/* END LOOP */
***********************
Now it is time to see if it works. Click in the check mark on the top left. If there are any errors it will start pointing them out to you. if you just can’t figure it out please let me know and I will help you out. Once it says it is done, then click on the right arrow button next to it to copy your program from your computer to the Arduino board.
Activities:
- Can you adjust the program to stay on longer?
- Can you adjust the program to stay off longer?
- Can you make any changes to the program to make a different blinking pattern?