User Tools

Site Tools


en-us_commands:reference:debugln

debugln()

debugln() outputs a debug value followed by a newline.

debugln command operation flow

void debugln()
void debugln(const __FlashStringHelper* value)
void debugln(const String& value)
void debugln(const char value[])
void debugln(char value)
void debugln(unsigned char value, int base = DEC)
void debugln(int value, int base = DEC)
void debugln(unsigned int value, int base = DEC)
void debugln(long value, int base = DEC)
void debugln(unsigned long value, int base = DEC)
void debugln(double value, int digits = 2)

Commands

Command Arguments Return Value Operation
debugln() None void Outputs a debug value followed by a newline.

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/debugln.txt · Last modified: by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki