This class provides functionality useful for debugging sketches via printf-style statements.

Overview

Arduino_DebugUtils

Check Arduino status Compile Examples status Spell Check status

This class provides functionality useful for debugging sketches via printf-style statements.

How-To-Use Basic

Arduino_DebugUtils has 6 different debug levels (described descending from highest to lowest priority):

  • DBG_NONE - no debug output is shown
  • DBG_ERROR - critical errors
  • DBG_WARNING - non-critical errors
  • DBG_INFO - information
  • DBG_DEBUG - more information
  • DBG_VERBOSE - most information

The desired debug level can be set via setDebugLevel(DBG_WARNING).

Debug messages are written via print which supports printf-style formatted output.

Example:

int i = 1;
float pi = 3.1459;
Debug.print(DBG_VERBOSE, "i = %d, pi = %f", i, pi);

If desired, timestamps can be prefixed to the debug message. Timestamp output can be enabled and disabled via timestampOn and timestampOff.

How-To-Use Advanced

Normally all debug output is redirected to the primary serial output of each board (Serial). In case you want to redirect the output to another output stream you can make use of setDebugOutputStream(&Serial2).

Documentation

Debug :

Arduino_DebugUtils Object that will be used for calling member functions.

Debug.setDebugLevel(int const debug_level) :

Parameter debug_level in order of lowest to highest priority are : DBG_NONE, DBG_ERROR, DBG_WARNING, DBG_INFO (default), DBG_DEBUG, and DBG_VERBOSE.

Return type: void.

Example:

Debug.setDebugLevel(DBG_VERBOSE);

Debug.setDebugOutputStream(Stream * stream) :

By default, Output Stream is Serial. In advanced cases other objects could be other serial ports (if available), or can be a Software Serial object.

Return type: void.

Example:

SoftwareSerial mySerial(10, 11); // RX, TX
Debug.setDebugOutputStream(&mySerial);

Debug.timestampOn() :

Calling this function switches on the timestamp in the Debug.print() function call; By default, printing timestamp is off, unless turned on using this function call.

Return type: void.

Example:

Debug.timestampOn();
Debug.print(DBG_VERBOSE, "i = %d", i); //Output looks like : [ 21007 ] i = 21 

Debug.timestampOff() :

Calling this function switches off the timestamp in the Debug.print() function call;

Return type: void.

Example:

Debug.timestampOff();
Debug.print(DBG_VERBOSE, "i = %d", i); //Output looks like : i = 21 

Debug.print(int const debug_level, const char * fmt, ...);

This function prints the message if parameter debug_level in the Debug.print(debug_level, ...) function call belongs to the range: DBG_ERROR <= debug_level <= (<DBG_LEVEL> that has been set using setDebugLevel() function).

Return type: void.

Example:

Debug.setDebugLevel(DBG_VERBOSE);
int i = 0;
Debug.print(DBG_VERBOSE, "DBG_VERBOSE i = %d", i);
Comments
Releases(1.4.0)
  • 1.4.0(Nov 2, 2022)

    What's Changed

    • Bump geekyeggo/delete-artifact from 1 to 2 by @dependabot in https://github.com/arduino-libraries/Arduino_DebugUtils/pull/30
    • Provide debug macros for debug prints. by @aentinger in https://github.com/arduino-libraries/Arduino_DebugUtils/pull/31
    • Bump carlosperate/download-file-action from 1 to 2 by @dependabot in https://github.com/arduino-libraries/Arduino_DebugUtils/pull/32

    Full Changelog: https://github.com/arduino-libraries/Arduino_DebugUtils/compare/1.3.0...1.4.0

    Source code(tar.gz)
    Source code(zip)
  • 1.3.0(Jun 23, 2022)

    What's Changed

    • Adding API to retrieve the debug level. by @aentinger in https://github.com/arduino-libraries/Arduino_DebugUtils/pull/24
    • Adding note explaining that there is no printf/float support on AVR. by @aentinger in https://github.com/arduino-libraries/Arduino_DebugUtils/pull/26
    • Provide API for printing the debug level as a string. by @aentinger in https://github.com/arduino-libraries/Arduino_DebugUtils/pull/27
    • Enable conditional formatting of timestamp. by @aentinger in https://github.com/arduino-libraries/Arduino_DebugUtils/pull/28

    Full Changelog: https://github.com/arduino-libraries/Arduino_DebugUtils/compare/1.2.0...1.3.0

    Source code(tar.gz)
    Source code(zip)
  • 1.2.0(Jun 15, 2022)

    What's Changed

    • Modernize continuous integration system by @per1234 in https://github.com/arduino-libraries/Arduino_DebugUtils/pull/10
    • Fix: va_start(va_list ap, paramN) needs to be parametrized with the latest named parameter in the parameter list. by @aentinger in https://github.com/arduino-libraries/Arduino_DebugUtils/pull/13
    • Add GitHub Actions workflow to synchronize with shared repository labels by @per1234 in https://github.com/arduino-libraries/Arduino_DebugUtils/pull/16
    • add "newlineOn" and "newlineOff" methods by @whyameye in https://github.com/arduino-libraries/Arduino_DebugUtils/pull/18
    • Bump actions/checkout from 2 to 3 by @dependabot in https://github.com/arduino-libraries/Arduino_DebugUtils/pull/19
    • Remove hardcoded line length limit by @abhaybd in https://github.com/arduino-libraries/Arduino_DebugUtils/pull/20
    • Bump actions/upload-artifact from 2 to 3 by @dependabot in https://github.com/arduino-libraries/Arduino_DebugUtils/pull/22
    • Bump actions/download-artifact from 2 to 3 by @dependabot in https://github.com/arduino-libraries/Arduino_DebugUtils/pull/21

    New Contributors

    • @whyameye made their first contribution in https://github.com/arduino-libraries/Arduino_DebugUtils/pull/18
    • @dependabot made their first contribution in https://github.com/arduino-libraries/Arduino_DebugUtils/pull/19
    • @abhaybd made their first contribution in https://github.com/arduino-libraries/Arduino_DebugUtils/pull/20

    Full Changelog: https://github.com/arduino-libraries/Arduino_DebugUtils/compare/1.1.0...1.2.0

    Source code(tar.gz)
    Source code(zip)
  • 0.1.3(Aug 21, 2020)

  • 0.1.2(Jul 22, 2019)

Owner
Arduino Libraries
This org contains the official Arduino Libraries. See @arduino for the tools (IDE, Pro IDE, CLI...)
Arduino Libraries
Easily and asynchronously interact with a serial device requiring call-and-response style commands.

Arduino Managed Serial Device Note This library was formerly less-descriptively named "Arduino Async Duplex" This library allows you to asynchronously

Adam Coddington 20 Nov 20, 2022
Easily and asynchronously interact with a serial device requiring call-and-response style commands.

Arduino Managed Serial Device Note This library was formerly less-descriptively named "Arduino Async Duplex" This library allows you to asynchronously

Adam Coddington 20 Nov 20, 2022
Arduino, esp32 and esp8266 library for ABB (ex PowerOne) Aurora Inverter, implement a full methods to retrieve data from the Inverter via RS-485

ABB Aurora protocol You can refer the complete documentation on my site ABB Aurora PV inverter library for Arduino, esp8266 and esp32 I create this li

Renzo Mischianti 22 Nov 22, 2022
Arduino Arduino library for the CloudStorage server project. The library provides easy access to server-stored values and operations.

Arduino-CloudStorage Arduino/ESP8266 library that allows you to easly store and retreive data from a remote (cloud) storage in a key/value fashion. Cl

Gil Maimon 7 Jan 30, 2022
Using shared memory to communicate between two executables or processes, for Windows, Linux and MacOS (posix). Can also be useful for remote visualization/debugging.

shared-memory-example Using shared memory to communicate between two executables or processes, for Windows, Linux and MacOS (posix). Can also be usefu

null 9 Aug 17, 2022
parse sql statements as strings to be used/modified in cpp.

parse sql statements as strings to be used/modified in cpp.

null 1 Mar 28, 2022
Simple printf functionality for GLSL.

Simple printf functionality for GLSL. This library is a simple proof of concept of using printf directly from a shader. The main point of being able

null 206 Dec 20, 2022
ImTricks is a collection of useful functions for expanding / improving the functionality of the ImGui.

ImTricks ImTricks is a collection of useful functions for expanding / improving the functionality of the ImGui. At the moment it has in itself: Functi

Alexander Pers0na2 22 Jun 13, 2022
Library with useful output stream tools like: color and style manipulators, progress bars and terminal graphics.

Library with useful output stream tools like: color and style manipulators, progress bars and terminal graphics Table of contents Introduction Documen

Gianluca Bianco 168 Dec 20, 2022
Some sketches for the VL53L5CX ranging camera for use with the Arduino IDE

VL53L5CX Some examples for the ST's VL53L5CX 8 x 8 pixel ranging camera using Simon Levy's Arduino library and Seth Bonn's multi-byte I2C read and wri

Kris Winer 18 Dec 8, 2022
Create simple visual sketches in Lua using SFML

Luna What is Luna? Luna is a simple game engine programmed in C++ and Lua which lets you create sketches and games in Lua Features Program in Lua, eas

XyronLabs 18 Dec 9, 2022
Collection of Arduino sketches for TDK's combo accel/gyro motion sensor

ICM42688 Collection of Arduino sketches for TDK's combo accel/gyro motion sensor The basic sketch configures the sensors' data rates and full scale se

Kris Winer 12 Dec 13, 2022
Set of Arduino sketches for Neotrellis 8x8 Feather M4 Express & NeoTrellisM4 (4x8) for use specifically with Trowasoft multiSeq and MindMeld Mixer modules for VCVRack2, with accompanying Rack file.

Set of Arduino sketches for Neotrellis 8x8 Feather M4 Express & NeoTrellisM4 (4x8) for use specifically with Trowasoft multiSeq and MindMeld Mixer modules for VCVRack2, with accompanying Rack file.

Marci 10 Dec 2, 2022
A hobby and performance-oriented Linux® distribution that provides aesthetics and practical functionality.

Heiwa/Linux A hobby and performance-oriented Linux® distribution that provides aesthetics and practical functionality.

Heiwa/Linux 26 Apr 29, 2022
C++11 provides chainable and iterable object for uniform die casts. Useful for statistics or table top RPG simulations.

12/1/2018 Due to feedback about compile-time limitations, the api has been changed since release. The api now supports user-defined literals which mak

null 12 Sep 5, 2021
PSTensor provides a way to hack the memory management of tensors in TensorFlow and PyTorch by defining your own C++ Tensor Class.

PSTensor : Custimized a Tensor Data Structure Compatible with PyTorch and TensorFlow. You may need this software in the following cases. Manage memory

Jiarui Fang 8 Feb 12, 2022
Blitz++ is a C++ template class library which provides array objects for scientific computing

Blitz++ is a C++ template class library which provides array objects for scientific computing

Peter Kümmel 17 Nov 22, 2020
KoanLogic 400 Dec 25, 2022
Debugging like a sir (in C)

Debugging like a sir (in C) #include "debug.h" int answer(void) { return 42; } int main(void) { int num = 1; char *str = "hello";

Dario Sneidermanis 263 Dec 5, 2022
This project aims to facilitate debugging a kernel driver in windows by adding support for a code change on the fly without reboot/unload, and more!

BSOD Survivor Tired of always telling yourself when you got a BSOD that what if I could just return to the caller function which caused the BSOD, and

Ido Westler 159 Dec 21, 2022