Blink LED Light
Blink LED Light
Make an LED blink on and off at a 1-second interval using Arduino code.
This demonstration illustrates the basic functionality of an Arduino by blinking the built-in LED.
Arduino Board
LED
hook-up wires
220 ohm resistor
You can use a resistor value other than 220 ohms with the LED, and the LED will still light up with values up to 1K ohms.
To begin, initialize the "LED_BUILTIN" pin as an output using a line of code in the Arduino Software (IDE).
pinMode(LED_BUILTIN, OUTPUT);
In the main loop, you turn the LED on with the line:
digitalWrite(LED_BUILTIN, HIGH);
This supplies 5 volts to the LED Next, use a line of code to turn off the voltage supplied to the LED, causing it to turn off.
digitalWrite(LED_BUILTIN, LOW);
The delay() commands in the code create pauses of 1000 milliseconds (1 second) between turning the LED on and off. During these delays, the Arduino does nothing else. For more advanced timing techniques, explore the Blink WithoutDelay example to learn how to create delays while performing other tasks.
Once you're familiar with this example, try the DigitalReadSerial example to learn how to read input from a switch connected to the Arduino board.
//Blink (Turns an LED on for one second, then off for one second, repeatedly.)
void setup() // initialize digital pin LED_BUILTIN as an output.
{
pinMode(LED_BUILTIN, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
Circuit:
If you have completed this successfully, move on to the next step.