Hello,
I've been commissioned to build a prototype of a measurement device used in construction. I'm using an ESP32 with a couple of LIDAR distance sensors and a Nextion touch display. I'm using an accelerometer as a digital level that displays all of the time on the display.
I'm having trouble receiving serial data from the Nextion display (button presses followed by values) because the accelerometer data is constantly being sent to the display. Unfortunately, I can not post the code because it's considered proprietary at this point. But the problem can be expressed like this:
void loop()
{
if(Serial.available()>0)
{
char received = Serial.read();
if(received == 'k'){
val = Serial.parseInt();
}
}
Serial.print("Something");
}
That code will not receive the data because it's constantly printing "Something". If I take the Serial.print("Something"); out, it receives fine.
My question is: Is there a way to prioritize RX over TX? I tried using ESP32 Software Serial to receive the data separately but couldn't get it to work at all. I'm hoping I can just pause the TX briefly while it's receiving the data, I just don't know how to do it.
If there isn't a software solution, can I add a fourth UART the the ESP32 and just receive through it? If so, what do I need to do it?
I would really appreciate any help with this because I'm almost done but totally stuck now. I'm very ignorant when it comes to serial communication so please dumb down any suggestions.
Thanks in advance!
I've been commissioned to build a prototype of a measurement device used in construction. I'm using an ESP32 with a couple of LIDAR distance sensors and a Nextion touch display. I'm using an accelerometer as a digital level that displays all of the time on the display.
I'm having trouble receiving serial data from the Nextion display (button presses followed by values) because the accelerometer data is constantly being sent to the display. Unfortunately, I can not post the code because it's considered proprietary at this point. But the problem can be expressed like this:
void loop()
{
if(Serial.available()>0)
{
char received = Serial.read();
if(received == 'k'){
val = Serial.parseInt();
}
}
Serial.print("Something");
}
That code will not receive the data because it's constantly printing "Something". If I take the Serial.print("Something"); out, it receives fine.
My question is: Is there a way to prioritize RX over TX? I tried using ESP32 Software Serial to receive the data separately but couldn't get it to work at all. I'm hoping I can just pause the TX briefly while it's receiving the data, I just don't know how to do it.
If there isn't a software solution, can I add a fourth UART the the ESP32 and just receive through it? If so, what do I need to do it?
I would really appreciate any help with this because I'm almost done but totally stuck now. I'm very ignorant when it comes to serial communication so please dumb down any suggestions.
Thanks in advance!