Utils  1.0.2
Utility functions and macros to print with arguments
Utils.h
Go to the documentation of this file.
1 #ifndef _Utils_h_
2 #define _Utils_h_
3 
4 #include <Arduino.h>
5 #include <Print.h>
6 
19 void myPrintf(const char* sFmt, ...);
20 
21 
34 void myPrintf(const String& sFmt, ...);
35 
36 
50 void myPrintf(Print& pr, const char* sFmt, ...);
51 
52 
66 void myPrintf(Print& pr, const String& sFmt, ...);
67 
68 
83 char* format(const char* sFmt, ...);
84 
89 #define serialBegin(speed) { Serial.begin(speed); while (!Serial); }
90 
91 #ifdef DebugMode
92 
96  #define DebugMessagePrintf(...) { myPrintf(__VA_ARGS__); }
97 
102  #define DebugSerialBegin(speed) { serialBegin(speed); }
103 
108  #define DebugDelay(amount) { delay(amount); }
109 #else
110 
114  #define DebugMessagePrintf(...) { }
115 
120  #define DebugSerialBegin(speed) { }
121 
126  #define DebugDelay(amount) { }
127 #endif
128 
129 #endif // _Utils_h_
format
char * format(const char *sFmt,...)
Print formatted data (equivalent to standard C printf) to a C string.
Definition: Utils.cpp:57
myPrintf
void myPrintf(const char *sFmt,...)
Print formatted data (equivalent to standard C printf) to the default Serial port.
Definition: Utils.cpp:3