🛠 Premier programme Arduino sur la Blue Pill (core officiel stm32duino)
Why the official core?
The Blue Pill is first-class supported by stm32duino/Arduino_Core_STM32, the Arduino core maintained by ST, based on STM32Cube HAL/LL, CMSIS, and the GNU Arm GCC compiler. The BLUEPILL_F103C8 target has been supported since core version 1.2.0. Note: since core release 2.8.0, only Arduino IDE 2 is supported. There is also a historical community core (rogerclarkmelbourne/Arduino_STM32, derived from libmaple, for Arduino IDE 1.8.x), but for getting started in 2026, the official core is recommended.
Step-by-step installation
- Open Arduino IDE 2, go to the Board Manager, and add the URL:
https://github.com/stm32duino/BoardManagerFiles/raw/main/package_stmicroelectronics_index.json. - Install “STM32F1 boards”.
- Select the board Generic STM32F1 series → BluePill F103C8.
The blink, Blue Pill version
The user LED is on PC13, in sink mode: LOW = on. The code below therefore blinks “in reverse” compared to a classic Arduino, and this is normal:
#include <Arduino.h>
void setup {
pinMode(PC_13, OUTPUT);
digitalWrite(PC_13, HIGH); // LED ÉTEINTE (câblée au VCC)
Serial1.begin(115200); // USART1 : PA9=TX, PA10=RX
analogRead(PA_0); // ADC1_IN0, 12 bits sur F103
}
void loop {
digitalWrite(PC_13, LOW); // LED ALLUMÉE (logique active-basse)
delay(250);
digitalWrite(PC_13, HIGH); // LED ÉTEINTE
delay(750);
Serial1.printf("ADC PA0=%u\r\n", analogRead(PA_0));
}
What this program does
Serial1corresponds to USART1 on PA9 (TX) / PA10 (RX) — the same port as the ROM bootloader. You need a USB serial adapter (FTDI) to see the messages, as the micro-USB connector on this board is not connected to a serial converter.analogRead(PA_0)reads the ADC1_IN0 input; the F103 has two 12-bit ADCs (PA0..PA7 among others) but no DAC (explicitly “No DAC” in the official variant files).- To upload without a debugger, see the “Powering and flashing” tutorial (BOOT0 + serial port or ST-Link adapter).
Other tutorials for this board
- Découvrir la Blue Pill : que trouve-t-on dans la boîte ?
- Alimenter et flasher la Blue Pill : BOOT0, port série, ST-Link et DFU
- Série, ADC et chasse aux contrefaçons : diagnostiquer sa Blue Pill
- Dompter l'USB natif de la Blue Pill : CDC, DFU et la résistance rebelle
- Passer au niveau supérieur : STM32CubeIDE, HAL et LL sur F103
- Firmware libre sur Blue Pill avec libopencm3 et OpenOCD