// Empty Raspberry Pi Pico 2 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 RASPI_PICO_2 // so that utils.h works for all boards
#define RASPI RASPI_PICO_2 | RASPI_PICO_W | RASPI_PICO
#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:
Serial.begin(115200);
N_MC_Utils::setup_serial_port();
N_MC_Utils::show_gcc_version();
Serial.println("Hello, Raspberry Pi Pico 2!");
FirstExample::setup_blink_red_LED();
}
void loop() {
// put your main code here, to run repeatedly:
delay(100); // this speeds up the simulation
// Serial.println("Hello, Raspberry Pi Pico 2!");
FirstExample::loop_blink_red_LED();
}
Loading
pi-pico-2
pi-pico-2