====== debug() ====== ''debug()'' outputs values only when debugging is enabled. {{:en-us_commands:reference:debug.svg?900|debug command operation flow}} ''void debug(const __FlashStringHelper* value)''\\ ''void debug(const String& value)''\\ ''void debug(const char value[])''\\ ''void debug(char value)''\\ ''void debug(unsigned char value, int base = DEC)''\\ ''void debug(int value, int base = DEC)''\\ ''void debug(unsigned int value, int base = DEC)''\\ ''void debug(long value, int base = DEC)''\\ ''void debug(unsigned long value, int base = DEC)''\\ ''void debug(double value, int digits = 2)'' ===== Commands ===== ^ Command ^ Arguments ^ Return Value ^ Operation ^ | ''debug(value)'' | ''const __FlashStringHelper* value'' | ''void'' | Outputs values only when debugging is enabled. | ===== Example ===== const bool DEBUG_MODE = true; void setup() { if (DEBUG_MODE) { debugStart(115200); // Set the port and baud rate for debug output. } } void loop() { checkInput(); checkOutput(); } void checkInput() { debug("AI0="); // Output values only when debugging is enabled. debugln(analogRead(A0)); // Read the raw analog value of the specified channel. / Output the debug value followed by a newline. } void checkOutput() { debug("millis="); // Output values only when debugging is enabled. debugln(millis()); // Output the debug value followed by a newline. } ===== Precautions ===== * Do not use the same port for Debug and product communication. * Rapid repeated output can slow the control cycle and communication responses. * Stop unnecessary Debug output before deploying for operation. ===== Built-in Commands in the Same Category ===== * [[:en-us_commands:reference:debugstart|debugStart() View detailed description]] * [[:en-us_commands:reference:debugstop|debugStop() View detailed description]] * [[:en-us_commands:reference:debugstate|debugState() View detailed description]] * [[:en-us_commands:reference:debugln|debugln() View detailed description]] [[:en-us_commands:builtin|← Built-in Command List]]