Example Code for Arduino-Light LED

Last revision 2026/01/18

The article offers a detailed tutorial on making an onboard LED blink using Arduino, covering hardware and software setup, wiring, and sample code to help beginners learn electronics programming.

Hardware Preparation

  • DFRobot Beetle RP2040, 1, Purchase Link
  • USB Type-C Cable, 1, (Standard USB 2.0 Type-C cable)

Software Preparation

Wiring Diagram

Wiring Diagram

Other Preparation Work

  1. Open Arduino IDE.
  2. Click the Tools menu and select "DFRobot Beetle RP2040" as the development board (see Getting Started).
  3. Connect the Beetle RP2040 to your computer using a USB Type-C cable.

Sample Code

Function: make the onboard LED blink at 1 second intervals.

void setup() {
  pinMode(LED_BUILTIN, OUTPUT);//set the pin to output mode
}

void loop() {
  digitalWrite(LED_BUILTIN, HIGH); //write high level to the port
  delay(1000);                    // delay for one second
  digitalWrite(LED_BUILTIN, LOW);  //write low level to the port  
  delay(1000);                   //delay for one second    
}

Result

The onboard LED blinks repeatedly at 1 second intervals.

Beetle RP2040 Development Board onboard LED blinks

Additional Information

  • The onboard LED is connected to pin 13, consistent with Arduino UNO.
  • The Blink routine is a standard example included in the Arduino IDE.

Was this article helpful?

TOP