Table of Contents

debugStart()

debugStart() sets the port and baud rate for debug output.

debugStart command operation flow

void debugStart()
void debugStart(unsigned long baudrate)
void debugStart(HardwareSerial& serialPort)
void debugStart(HardwareSerial& serialPort, unsigned long baudrate, uint8_t config = SERIAL_8N1)

Commands

Command Arguments Return Value Operation
debugStart() None void Sets the port and baud rate for debug output.

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

Built-in Commands in the Same Category

← Built-in Command List