Presentation is loading. Please wait.

Presentation is loading. Please wait.

Arduino Part 4 Let there be more light.

Similar presentations


Presentation on theme: "Arduino Part 4 Let there be more light."— Presentation transcript:

1 Arduino Part 4 Let there be more light

2 Having one LED blink is pretty cool for your first project but lets step it up a little bit. This time we are going to try and control 3 LED at one time. We are going to build the circuit below.

3 Resistors Before we move on to the building part lets look at an important part of the circuit. Resistors!! We need to understand a little bit about the parts that we are putting on the Arduino board. A resistor is a component that slows the flow of electrons through the circuit. The LED needs only 3.5 volts to light up but we are sending 5volts to it. So we need a component to protect the LED from the excesses voltage, if not the LED will burn out. Resistors are measured in Ohms, named after Moe Ohmns who discovered it. Resistance can be from as little as 10 ohms to over a million ohms.

4 Detour To tell how much resistance a resistor has, you look at the stripes on it. You will notice that there will be a gold stripe on every resistor, that goes to the right side. Then look at the 3 stripes on the left, below is a code that will help you determine the resistance value of the resistor.

5 Detour So how does this work. First grab the resistor that has the color code ORANGE, ORANGE, BROWN. Now the first color is red and if we look at our chart, red as the first color has a value of 3. Then we have red as the second color that also has a value of 3. We put those numbers together and get 33. The third stripe is the multiplier, here we have brown which is 10, that means we are multiply 33 x 10 = 330 ohms. So this resistor has 330 ohms of resistance. Figure this resistor out, Brown, Black, Red.

6 The Answer Figure this resistor out, Brown, Black, Red.
Brown = 1, Black = 0 (put them together to be 10) and red means multiply by 100 So we have 10 x 100 = 1000

7 Lets Build a Circuit Grab your Arduino board and parts container and let get started. Connect a wire from GND on the Arduino board to the “negative -” side of the breadboard by hole 12

8 Lets Build a Circuit Time to add the resistors 330 ohms (orange, orange, brown). Place the resistors where one end of the resistor in in the “-” column on the breadboard and the other end goes into 11-C, 15-C, and 19-C.

9 Lets Build a Circuit Now we have to add the three LED. Remember that each LED has a long leg the anode and a short leg the cathode. The first LED will go Long leg 12-E, short leg 11-E. The second LED, long leg 16-E, short leg 15-E. The third LED, long leg 20-E, short leg 19-E. Now is a good time to double check what you have done. Take a look at the circuit does it look like yours ? If so continue on.

10 Lets Build a Circuit We need to add three wires that will power the LED. So connect a wire from Pin 13 to 12-D, then from Pin 12 to 16-D and then Pin 11 to 20-D. The circuit is now complete.

11 Time to Write The Code We now have three LED’s we need to control, the first step will be to set the variable for the delay time. We do this above the “void setup” section. The next step is to set the pinMode for each of the pins connected to the LED’s. We do this in the “void setup” area.

12 Time to Write The Code Now lets turn on all 3 LED’s. We need to use the digitalWrite command to do this. In the “void loop” section place the following code.

13 Download and Run Ok it is now time to download and run the program, remember you need to press the Check mark icon first to verify our program is correct. Then press the Right Arrow icon to download the program to the Arduino board. What happened?

14 Review All three LED’s should have turned on, (using the digitalWrite command) now this is nothing spectacular but it does show you how to control multiple components on the Arduino board. Now lets change the program to make it a little more interesting.

15 More Blinking Change the commands in the “void loop” section to the code below. Also change the variable “time” to equal a 1000. Your program should now look like this. When finished with the changes.

16 What Happened Your project should look like the one below, you should have the 3 LED’s blinking. Did you? If not call me over so we can figure it out.

17 Take a look at the program below and read the comments after the // this explains what each command does

18 Credit Call me over so I can see you have built the circuit correctly, remember you get credit for each circuit you build correctly.

19 Quiz time It is time to show me what you have learned, this time there is not a quiz but you have to build me a project. To start remove all the parts from your Arduino board, and start a new program. Call me over so I can see you are starting with a clean slate. Now build a circuit that makes 2 LED’s blink opposite of each other. Continued on next slide

20 Quiz time You can go back and use the power points to help you set up the circuit, and help you write the program. You will need 2, 330 Ohms resistors, 2 LED’s and 3 wires. Remember the short leg of the LED’s are the negative side and need to be connected to the GND on the Arduino board. The long legs are positive and need to be connected to the Pin numbers that you use. You know all the information needed you just need to think your way through it, try and do as much as you can on your own, but if you are really stuck call me over for help.


Download ppt "Arduino Part 4 Let there be more light."

Similar presentations


Ads by Google