// Empty STM32 project project for your own exercises
// in my trainings
// Embedded C++ Grundkurs (www.rkaiser.de und www.tae.de)
// Embedded C++ Aufbaukurs (www.rkaiser.de und www.tae.de)
// or with my book
// Modernes C++ für Embedded-Systeme
// Objektorientierte Mikrocontrollerprogrammierung
// und die MISRA C++:2023 Guidelines
// that will be published in 2027 by Springer-Verlag
// Configuration macros so that MC_Utils.h, MC_Examples.h etc.
// work for different boards (STM32 C031C6, ESP32,
// Raspberry Pi Pico), gcc compiler versions (gcc 14, 15, 16)
// and IDEs (Arduino IDE, Visual Studio with Visual Micro,
// VS Code and PlatformIO)
#define STM32_C031C6
#ifdef STM32_C031C6
# define SMALL_MEMORY
# define STM32_NUCLEO
#endif
#define WOKWI_USED
#include "MC_Utils.h"
using namespace N_MC_Utils;
namespace FirstExample
{
// use the pin numbers from the board
uint32_t pin = N_MC_Utils::PinNr::red_LED;
void setup_blink_red_LED()
{
pinMode(pin, OUTPUT);
}
void loop_blink_red_LED()
{
digitalWrite(pin, HIGH);
delay(500);
digitalWrite(pin, LOW);
delay(500);
}
} // namespace FirstExample
// **** write you own code here *********
void setup()
{
// put your setup code here, to run once:
N_MC_Utils::setup_serial_port();
N_MC_Utils::show_gcc_version();
Serial.println("Hello, STM32!");
FirstExample::setup_blink_red_LED();
}
void loop()
{
// put your main code here, to run repeatedly:
delay(10); // this speeds up the simulation
FirstExample::loop_blink_red_LED();
}
Loading
st-nucleo-c031c6
st-nucleo-c031c6