Skip to content

Instantly share code, notes, and snippets.

@bmcdonnell
bmcdonnell / Serial_printf.h
Created April 6, 2021 18:34 — forked from alw1746/Serial_printf.h
Basic printf functionality for the Arduino serial ports
/* https://gist.github.com/ridencww/4e5d10097fee0b0f7f6b
* Simple printf for writing to an Arduino serial ports eg. Serial..Serial3. Note: format
* specifier must match actual argument type eg. int32 should be formatted as %l, not %d.
* Usage: Serial_printf(Serial,"%d\n",vars);
* %B binary (d = 0b1000001) %b binary (d = 1000001) %c character (s = H)
* %d/%i integer (d = 65) %o boolean on/off (d = On) %% escaped percent ("%")
* %f float (f = 123.45) %.3f/%3f float (f = 123.346) %l long (d = 65)
* %s char* string (s = xyz) %X hexadecimal (d = 0x41) %x hexadecimal (d = 41)
*/
template<typename... Args>