Get one LED to blink on and off.
Equipment:
-1 x Arduino Uno
-1 x Breadboard
-3 x Wire
-1 x LED
-1 x 560 Ohm Resistor
Reference:
http://www.oomlout.com/a/products/ardx/circ-01
Program Details:
This experiment was a little introduction to Arduino. It shows the basic code structure and how it relates to what's happening on hardware.
Time to Complete:
5 minutes
Results:
The LED lit up with no problems.
Photos of Project:
Tips:
Straight forward experiment, just make sure that the LED is in the right way (long side is positive).
Further Work:
I can try to make it blink faster or slower by changing the delay.
Program Modifications:
The program is exactly the one from http://www.oomlout.com/a/products/ardx/circ-01
Program:
int ledPin = 13; // the pin the LED is connected to.
// The setup() method runs once, when the sketch starts
void setup()
// The setup() method runs once, when the sketch starts
void setup()
{
pinMode(ledPin, OUTPUT); //initializes pin 13 as an output
}
void loop() //Continuously runs
{
digitalWrite(ledPin, HIGH); // changes the state of ledPin to high(on)
delay(1000); // delay equal to the 1000 millisecons
digitalWrite(ledPin, LOW); // changes the state of ledPin to low(off)
delay(1000); // delay equal to the 1000 millisecons
pinMode(ledPin, OUTPUT); //initializes pin 13 as an output
}
void loop() //Continuously runs
{
digitalWrite(ledPin, HIGH); // changes the state of ledPin to high(on)
delay(1000); // delay equal to the 1000 millisecons
digitalWrite(ledPin, LOW); // changes the state of ledPin to low(off)
delay(1000); // delay equal to the 1000 millisecons
}
No comments:
Post a Comment