🛠 Premier sketch : faire clignoter une LED sur Arduino Opta
Objectives
Discover the Arduino Opta, Arduino's certified micro-PLC (STM32H747XI dual-core Cortex-M7 480 MHz + Cortex-M4 240 MHz), by programming your first sketch: making a user LED blink. By the end of this tutorial, you will know how to install the core, upload a sketch, and understand the basic pinout.
Hardware
- An Arduino Opta board (Lite AFX00003, RS485 AFX00001, or WiFi AFX00002)
- A USB-C cable for programming
- A PC with Arduino IDE 2.x
- No 24 V power supply is needed for this test: USB-C powers the processor (but never the relays!)
Complete code
// opta_clignotement_led.ino — core « Arduino Mbed OS Opta Boards »
// Les 4 LED utilisateur sont pilotables via les broches LED1..LED4.
const int LEDS[] = {LED1, LED2, LED3, LED4};
void setup {
Serial.begin(9600);
for (int i = 0; i < 4; i++) {
pinMode(LEDS[i], OUTPUT);
digitalWrite(LEDS[i], LOW);
}
Serial.println("Opta : demo LED prete");
}
void loop {
for (int i = 0; i < 4; i++) {
digitalWrite(LEDS[i], HIGH);
delay(200);
digitalWrite(LEDS[i], LOW);
}
}
Expected verification
The 4 user LEDs blink in sequence (a "chaser" effect) every 200 ms. The serial monitor displays the startup message. On the WiFi variant, a fifth network status LED remains managed by the firmware.
Common errors
- Wrong core selected: install "Arduino Mbed OS Opta Boards" (or its successor ArduinoCore-zephyr, same API) in the Boards Manager and choose "Arduino Opta".
- Upload failure: press the RESET button twice quickly (double-click) to enter DFU mode if the sketch hangs, then restart the upload.
- Confusing user LEDs with relay outputs: the relays (D0..D3) control the 230 V load, while LED1..LED4 are simple logical indicators.
- Forgetting the 12–24 VDC power supply in operation: USB-C can never power the relay outputs.
Other tutorials for this board
- Lire une entrée numérique 24 V (capteur de proximité)
- Commander une charge 230 V avec un relais de sortie
- Server Modbus TCP : exposer les relais sur Ethernet
- Lire un capteur analogique 0–10 V sur les entrées Opta
- Remonter des données machine en MQTT via Ethernet
- Exploiter le double cœur : M7 pour le PLC, M4 en coprocesseur
Code examples for this board
relais_securise.inoArduinoentrees_numeriques.inoArduinoanalogique_0_10v.inoArduinomodbus_tcp_esclave.inoArduinomodbus_rtu_maitre.inoArduinomqtt_telemetrie.inoArduino