02-21-2024 09:03 PM
Hello,
Here is a VI implementing a TCP protocol with the ESP32.
I can get an LED to turn on and off using TCP write.
I can get a temperature reading from the Thermistor using TCP read.
But when I put them both together in the VI, it doesn't work.
The LED is not working or works slowly.
I am not sure how to get both connections to work simultaneously.
Thank you.
02-22-2024 06:53 AM
The description for how it doesn't work is not very clear and I don't know the APIs in the microcontroller, so hopefully these comments can help:
My guess would be that you're sending fewer than 8 bytes and then the TCP read waits for more data which will only come after you send to the ESP through the serial terminal.
02-22-2024 11:11 AM
Hi,
Thank you.
The TCP read part works great by itself. I attached a screenshot of that below.
This is functioning. The data is coming in through TCP. And, yes, I write something in the serial port, and it starts reading the temp.
The button by itself is also functioning when programmed below with the same C++ code:
The problem happens when I put them both together. The button does not work with the LED anymore.
I will try to probe/ add indicators, as you said.
I am trying to understand how the TCP read/TCP write functions affect each other.
02-25-2024 06:55 AM
There seem to be a couple of difference between this code and the previous one:
To be clear, the read and write parts don't directly affect each other here (unless the write would generate an error which would prevent the read from running), but because they are in the same loop, both have to complete before the next iteration of the loop can run (and if you don't get 8 bytes, the read will be stuck waiting for them, which is probably what happens).
02-28-2024 04:05 PM
Ok thank you. This helps in understanding better how the read and write work.
I will try different settings for the read and see if this is affecting the loop.