Arduino lesson 002 Extension of the LED

coolyou1Arduino, Computer Hardware, Open Source, Robotics, Science, Tutorial

In this lesson we are going to have an off board LED turn on and off over a period of 1 second. I will include pictures, code and instruction how to do the following tutorial. As a bonus I will include a challenge section on the bottom. See if you can do it and if you can have fun with it.

 

Parts: Today we are going to need the following.

20130924_223014[1]

1. Arduino

2. 10K Resistors

3. Any color LED

4. USBA to USBB cable

20130921_221608[1]

5. Bread board any size

You can find all of these things in the Arduino Uno Ultimate Starter Kit.

 

Step one connect the bread board: I will include electrical schematic for those who can read them, and for those who can’t; here is the picture schematics. One important note LED’s are polar meaning they can fry if there is in an incorrect positive to ground placement. Here are the schematics for the led placement.

 

F1: Long LED leg

F2: Short leg placement

G1: Resister leg one

Positive: Resister leg two

G2: cable one leg one

Positive: Cable two leg one

GND Arduino: Cable one leg two

Pin 8 Arduino: Cable Two leg Two

 

Step Two: Connect Arduino to computer Through USBB to USBA

 

Step Three: Code The following code; will be commented to help you understand what is going on.

 

int ledpin = 8; //Declaring you varible and declaring your position of led

void setup() // Intitilizing ledpin as an output
{
pinMode(ledpin, OUTPUT); // Setting up LED as an output
}
void loop() // The while loop function

{

digitalWrite(ledpin, HIGH); // High means on
delay(1000); // waits 1000 milliseconds
digitalWrite(ledpin, LOW); // Low means off
delay(1000); // waits 1000 milliseconds
}

To download and copy straight to your IDE click here Code

20130925_174108[1]

Now time for the challenge: See if you can have multiple LED going on and off at the same time

Hint: Rename you variables the rest is the same.