🛠 Faire clignoter une LED avec la Particle Boron
Objectives
The Particle Boron is an IoT board in the Adafruit Feather form factor, based on an nRF52840 (Cortex-M4F 64 MHz, 1 MB flash, 256 KB RAM) with an LTE-M cellular module. It is programmed in C/C++ using the Particle Device OS Wiring API. This first tutorial validates your development chain: firmware compiled, flashed via USB, and executed on the board. You will learn how to configure a pin as an output (pinMode), turn it on and off (digitalWrite), and add delays (delay), by controlling an external LED and the embedded status RGB LED.
Hardware
- 1× Particle Boron (BRN404X recommended, currently the only model recommended by Particle)
- 1× micro-USB data cable (cheap cables without data pins prevent flashing)
- 1× red LED + 220 to 330 Ω resistor
- 1× breadboard and jumper wires
- PC with Visual Studio Code + Particle Device Cloud extension, or Particle CLI installed
Complete Code
// Boron — clignotement LED (Particle Device OS 4.x LTS)
const uint16_t LED_PIN = D7; // broche GPIO libre de votre choix (D2-D8 en PWM)
void setup {
pinMode(LED_PIN, OUTPUT);
RGB.control(true); // prend le contrôle de la LED RVB embarquée
}
void loop {
digitalWrite(LED_PIN, HIGH);
RGB.color(255, 0, 0); // rouge = LED allumée
delay(500);
digitalWrite(LED_PIN, LOW);
RGB.color(0, 0, 80);
delay(500);
}
Compile and flash via USB: particle flash <device_name> . (or the Flash button in VS Code). The board should restart with your firmware.
Expected Verification
The external LED blinks at 1 Hz (500 ms on, 500 ms off) and the board's RGB LED follows the color change. The USB serial port is available for Serial.print if you add it. This is the basic test: if it works, your environment is ready for the following tutorials.
Common Errors
- USB cable is "charge only": the board does not appear in
particle listnor in DFU mode. - LED mounted backwards (anode/cathode reversed): it never lights up.
- Missing resistor: the LED shines brightly then dims, the pin is stressed beyond 2 mA (standard drive).
- Confusing the status RGB LED (controlled by the system) with your application LED;
RGB.control(true)is required to control it. - 2G/3G models (BRN310/314, deprecated) require 2 A via USB or a connected LiPo battery due to modem peaks; with a BRN404X, 500 mA is sufficient.
Other tutorials for this board
Code examples for this board
clignotante.inoArduinobouton-evenement.inoArduinofonction-distance.inoArduinocapteur-dht.inoArduinoruban-neopixel.inoArduinopwm-respiration.inoArduino