LED (Light emitting diodes) are small, powerful lights that are used in many different applications. To blink an led, i.e (on and off repeatedly) using ARDUINO involves the following components and procedures.
Components Required.
- 1 × Breadboard.
- 1 × Arduino Uno.
- 1 × LED.
- 1 × 330Ω
Resistor.
- 2 × Jumper
wires.
Procedure.
use this
circuit diagram and connect up the components on the breadboard as shown in the
image given below.
Note: LED have polarity (positive and negative terminals),longer leg is the POSITIVE while the shorter leg is the NEGATIVE.
Sketch
Open your Arduino IDE,copy and past this code
/*
Blink
Turns on an LED on for one second, then off
for one second, repeatedly.
*/
#define LED=8;//means led
is connected to digital pin 8
void setup() { // initialize LED as an output.
pinMode(LED, OUTPUT);// informs Arduino that LED is Output
}
// the loop function runs
over and over again
void loop() {
digitalWrite(LED, HIGH); // turn the LED on
delay(1000); // wait for a second
digitalWrite(LED, LOW); // turn the LED off
delay(1000); // wait for a second
}



No comments :
Post a Comment