🛠 Faire clignoter la LED D7 du Photon
Objectives
Discover the Photon's Wiring programming model (setup and loop functions), control the user LED connected to pin D7, and understand that the firmware is split between the Device OS (FreeRTOS system, radio, and cloud) and your small C/C++ application.
Hardware
- 1 Particle Photon board (STM32F205 ARM Cortex-M3 @120 MHz + Broadcom BCM43362 Wi-Fi chip)
- 1 high-quality micro-USB cable (Particle warns: a poor-quality cable causes voltage drops during Wi-Fi transmission peaks and leads to brown-outs)
- 1 computer with the Particle CLI installed
Complete Code
// photon-clignotement-led.ino — clignotement de la LED utilisateur D7
const int LED_PIN = D7; // LED jaune utilisateur sur D7
void setup {
pinMode(LED_PIN, OUTPUT);
Serial.begin(9600); // trace série sur l'USB
}
void loop {
digitalWrite(LED_PIN, HIGH);
Serial.println("LED ON");
delay(500);
digitalWrite(LED_PIN, LOW);
delay(500);
}
Expected Verification
The yellow D7 LED blinks every 500 ms immediately after startup. The RGB LED breathes cyan when the Photon is connected to the Particle Cloud (breathing cyan = online, confirmed by the datasheet). Compile and flash using particle flash <device_name> . or particle flash <name> firmware.bin; the message “LED ON” appears on the serial port at 9600 bauds.
Common Errors
- Confusing the user LED D7 (controllable via digitalWrite) with the status RGB LED (reserved for the system).
- Forgetting
pinMode(D7, OUTPUT): the LED remains off without any visible error. - Using a poor-quality USB cable: random reboots occur as soon as the Wi-Fi transmits.
- Forgetting that the logic level is 3.3 V: all pins are 5 V-tolerant except A3 and DAC.
Other tutorials for this board
Code examples for this board
clignotante.inoArduinobouton-evenement.inoArduinofonction-distance.inoArduinocapteur-dht.inoArduinoruban-neopixel.inoArduinopwm-respiration.inoArduino