en-us_commands:reference:debugstate
This is an old revision of the document!
Table of Contents
debugState()
Commands
| Command | Arguments | Return Value | Operation |
|---|---|---|---|
debugState() | None | bool | Returns whether debug output is enabled. |
Example
void setup() { debugStart(Serial, 115200, SERIAL_8N1); // Set the port and baud rate for debug output. debugln(F("diagnostics ready")); // Output the debug value followed by a newline. } void loop() { const int32_t input = analogRead(A0); // Read the raw analog value of the specified channel. if (debugState()) { // Return whether debug output is enabled. debug(F("A0=")); // Output values only when debugging is enabled. debugln(input); // Output the debug value followed by a newline. } if (IdigitalRead(0, 5)) debugStop(); // Read the input repeatedly and update only if all samples match. If HIGH and LOW are mixed, retain the previous stable state. / Stop debug output. delay(250); }
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/debugstate.1788791733.txt.gz · Last modified: by 127.0.0.1
