Arduino: Write on console only and not hardware

How do I write a debug var on console but not on the serial hardware?

I tried Console.write; I tried Serial.flush().

The problem is when I print the return value (rep) for debugging it is also sent to my hardware on RX/TX and creating errors.

int start_of_text = 0x02; int end_of_text = 0x03; String cmd = "cmdtosend"; String rep = "returnvalue"; void setup() { Serial.begin(115200); } void loop() { cmd = "TV,100"; writeCOM(cmd); } void writeCOM (String cmdtosend) { cmd = "\02\02" + cmdtosend + "\03"; Serial.print(cmd); delay(200); if (Serial.available() > 0) { rep = Serial.readString(); } cmd = " "; rep = " "; delay(800); } 
3

1 Answer

If I am not wrong it is impossible, because these code is running on arduino, not on your computer. If you want see something from uC you must send it by serial.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like