Example Code for Arduino-Blink a LED

Last revision 2026/02/05

This chapter starts with blinking an LED to demonstrate the usage of FireBeetle 2 ESP32-E.

Hardware Preparation

Other Preparation Work

The LED(circled in red below) on FireBeetle 2 ESP32-E is default to be connected to pin 2/D9. Now make it blink by programming.
DFR0654-LED

Sample Code

The on-board LED blinks at an interval of 1 second.

int ledPin = D9;    //Define LED pin 
void setup(){
   pinMode(ledPin, OUTPUT);// Set ledPin as output mode 
}

void loop(){
   digitalWrite(ledPin, HIGH);   // Outputting high, the LED turns on 
   delay(1000);     //Delay 1 second 
   digitalWrite(ledPin, LOW);  // Outputting low, the LED turns off
   delay(1000);           
}

Result

When the program is uploaded, the on-board LED blinks at a one-second interval repeatedly.

Was this article helpful?

TOP