Skip to content
This repository has been archived by the owner on May 26, 2024. It is now read-only.

Arduino library for providing convenient macros for printf-style debugging.

License

Notifications You must be signed in to change notification settings

107-systems/107-Arduino-Debug

Repository files navigation

107-Arduino-Debug

Arduino Library Badge Compile Examples Check Arduino Check keywords.txt General Formatting Checks Spell Check

Arduino library for providing convenient macros for printf-style debugging.

This library works for

Example

#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