Hi there, I am trying to send hex codes over the serial port. I am using the serial monitor to send these and then my code recieves the hex code and stores the binary version in an array and then it prints this binary version to the serial as a response .
However ! with my current code above, it gets stuck in a loop of receiving and sending serial messages, My thoughts is that when it sends the reply over serial it is triggering the code to run again, I have added a delay and serial.flush() to try and resolve the issue but nothing seems to be fixing it.
The flush() does not remove characters from the Serial receive buffer, rather it waits until all data has been sent from the Serial transmit buffer. The delay() will just wait for 200 milliSeconds doing nothing. Neither will be helpful
Please post your complete sketch and confirm that you are using an ESP32 or ESP8266 board
The bulk of the code runs when there is Serial data to be read but as currently written the Serial data is never removed from the buffer so once it is available() it remains available() so the code runs again, and again, and again.....
I dont know if youd be up for offering a thought to my new issue ?..
Sending the hex string 0x2f ( Same as what i had hard coded here char hex_number = Serial.read(); //char hex_number = 0x2f; //0010 1111) does not seem to be working the same as hard coding the char to 0x2f