en-us_commands:reference:debugstart
This is an old revision of the document!
Table of Contents
debugStart()
debugStart() sets the port and baud rate for debug output.
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
- 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.
en-us_commands/reference/debugstart.1788791733.txt.gz · Last modified: by 127.0.0.1
