Arduino library for providing convenient macros for printf-style debugging.
This library works for
- ArduinoCore-samd:
Arduino Zero
,MKR 1000
,MKR WiFi 1010
,Nano 33 IoT
,MKR GSM 1400
,MKR NB 1500
,MKR WAN 1300/1310
✔️ - ArduinoCore-mbed:
Portenta H7
,Nano 33 BLE
,Nano RP2040 Connect
,Edge Control
✔️ - arduino-esp32:
ESP32 Dev Module
,ESP32 Wrover Module
, ... ✔️ - arduino-pico:
Raspberry Pi Pico
,Adafruit Feather RP2040
, ... ✔️ - ArduinoCore-renesas:
Portenta C33
,Uno R4 WiFi
,Uno R4 Minima
, ... ✔️
#define DBG_ENABLE_ERROR
#define DBG_ENABLE_WARNING
#define DBG_ENABLE_INFO
#define DBG_ENABLE_DEBUG
#define DBG_ENABLE_VERBOSE
#include <107-Arduino-Debug.hpp>
/* ... */
DEBUG_INSTANCE(80, Serial);
/* ... */
void setup()
{
Serial.begin(9600);
while (!Serial) { }
DBG_ERROR ("A serious error has occurred during operation X: %d", -42);
DBG_WARNING("No connection to %s, retrying in %d seconds ...", "127.0.0.1", 5);
DBG_INFO ("Did you know you can also print octal values: %o", 0xCA);
DBG_DEBUG ("MCP2515 CANSTAT = 0x%02X", 0xFE);
DBG_VERBOSE("You are probably aware that PI = %4.2f", PI);
}
/* ... */
Note: If you enable pretty printing using 4-bit shell color escape sequences via prettyPrintOn
then you'll need to start minicom
with --color=on
:
minicom -D /dev/ttyACM0 --color=on