Created
September 15, 2021 10:24
-
-
Save xidameng/a433436921e0325426ea71303afc8dde to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Comment the following line to disable DEBUG log | |
#define __DEBUG__ | |
#ifdef __DEBUG__ | |
// You should only uncomment 1 version at a time! | |
// Version 1 | |
//#define DEBUG(...) Serial.println(__VA_ARGS__) | |
// Version 2 | |
#define DEBUG(...) Serial.println(__VA_ARGS__); \ | |
Serial.print(" @ [SRC]: "); \ | |
Serial.println(__FILE__); \ | |
Serial.print(" @ [LINE]: "); \ | |
Serial.println(__LINE__); \ | |
Serial.print(" @ [FUNCTION]: "); \ | |
Serial.println(__func__); | |
#else | |
// else DEBUG is diabled | |
#define DEBUG(...) | |
#endif | |
void setup() { | |
Serial.begin(115200); | |
DEBUG("--Debug starts--"); | |
} | |
void loop() { | |
DEBUG("++Debug #1++"); | |
delay(1000); | |
DEBUG("==Debug #2=="); | |
delay(1000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment