Currently Empty: $0.00

After you build the circuit, plug your Arduino board into your computer, start the Arduino Software (IDE), and enter the code below. You may also load it from the menu:
File → Examples → 01.Basics → Blink.
Code
/*
Blink
*/
Turns an LED on for one second, then off for one second, repeatedly.
// Create a variable for the LED pin
int ledPin = 13; // Built-in LED pin on most Arduino boards
void setup() {
// This runs once when you power or reset the board
// Initialize pin 13 as an output pin
pinMode(ledPin, OUTPUT);
}
void loop() {
// This runs continuously in a loop
digitalWrite(ledPin, HIGH); delay(1000); // Turn LED on (apply 5V)
// Wait 1 second (1000 ms)
digitalWrite(ledPin, LOW); delay(1000); // Wait 1 second
// Turn LED off (apply 0V)
}
Line-by-Line Explanation
• int ledPin = 13; → Defines the LED pin. Pin 13 is chosen because Arduino boards have an onboard LED
connected there.
• void setup() → Runs once at startup. The first thing you do is to initialize the LED pin as an output using:
• pinMode(LED_BUILTIN, OUTPUT);
This allows the Arduino to send current to the LED.
• void loop() → Runs forever in a cycle.
- digitalWrite(ledPin, HIGH); → Supplies 5 volts to the LED’s anode. That creates a voltage difference across the LED and lights it up.
- delay(1000); → Waits for 1 second so the LED stays visibly ON.
- digitalWrite(ledPin, LOW); → Brings the pin back to 0 volts, turning the LED off.
- delay(1000); → Waits for another second with the LED OFF.
This sequence repeats endlessly, causing the LED to blink every second.