Created
August 2, 2024 09:42
-
-
Save Mayoogh/aab5be71478fce29d58a6e1c8a2f6f4f to your computer and use it in GitHub Desktop.
Debug Serial
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
#define DEBUG 1 // Set to 0 to disable debugging, 1 to enable | |
#if DEBUG | |
#define DEBUG_PRINT(x) Serial.print(x) | |
#define DEBUG_PRINTLN(x) Serial.println(x) | |
#else | |
#define DEBUG_PRINT(x) | |
#define DEBUG_PRINTLN(x) | |
#endif | |
void setup() { | |
Serial.begin(9600); | |
// Actual operation serial prints | |
Serial.println("Starting the system..."); | |
// Debugging serial prints | |
DEBUG_PRINTLN("Debug: Entering setup"); | |
// Other setup code | |
} | |
void loop() { | |
// Actual operation serial prints | |
Serial.println("System running..."); | |
// Debugging serial prints | |
DEBUG_PRINTLN("Debug: Inside loop"); | |
// Other loop code | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment