The Blinking LED
Description
Built a simple circuit with 1 LED and a resistor to make the LED blink. For a bit of fun I plaid with blinking speeds - blinking evenly, on longer, off longer, etc. Quite straightforward.
lab1_led_big
Components
1 red LED
1 red,red,brown,gold resistor (220 ohm?)
Arduino Code
/* Blinking LED
* ------------
*
* turns on and off a light emitting diode(LED) connected to a digital
* pin, in intervals of 2 seconds. Ideally we use pin 13 on the Arduino
* board because it has a resistor attached to it, needing only an LED
*
* Created 1 June 2005
* copyleft 2005 DojoDave <http://www.0j0.org>
* http://arduino.berlios.de
*
* based on an orginal by H. Barragan for the Wiring i/o board
*/
int ledPin = 7; // LED connected to digital pin 13
void setup()
{
pinMode(ledPin, OUTPUT); // sets the digital pin as output
}
void loop()
{
digitalWrite(ledPin, HIGH); // sets the LED on
delay(400); // waits for a second
digitalWrite(ledPin, LOW); // sets the LED off
delay(1000); // waits for a second
}
Comments
thanks for getting this up!
thanks for getting this up!