Example Code for Arduino-LED Blink
Last revision 2025/11/29
This article provides a detailed guide on creating an LED blink project using Arduino, covering hardware setup, software requirements, wiring instructions, and sample code to help beginners understand basic Arduino operations.
Hardware Preparation
- Gravity: Digital LED Light Module (SKU:DFR0021 x 1) Any color
- DFRduino UNO R3 with IO Expansion Shield and USB Cable A-B (SKU:DFR0216-2 x 1)
Software Preparation
- Development Tool: Arduino IDE (version unspecified). Download link: Arduino IDE
Wiring Diagram

Sample Code
///Arduino Sample Code for DFR0021
///www.DFRobot.com
///Last modified on 26th February 2015
int led = 3;
void setup()
{
pinMode(led, OUTPUT); //Set Pin3 as output
}
void loop()
{
digitalWrite(led, HIGH); //Turn on led
delay(2000);
digitalWrite(led, LOW); //Turn off led
delay(2000);
}
Result
Turn on for two seconds, turn off for two seconds, and repeat in a loop.
Was this article helpful?
