Sir,
In my project I’m sending an integer data from Jetson Nano to Arduino Uno. The Arduino receives the data continuously without any interruption. The integer is basically an angle which operates the servo. I didn’t want the Jetson to continuously send or Arduino to receive it. I want the data in the serial monitor of Arduino only at a specific time . Is there any way ? I think you might have understood the issue . Can anyone provide a solution? Please reply as soon as possible.
I don’t think changing the serial port setup itself is a solution. There are, however, several ways to tell your program (or a thread of the program) to pause for a certain time or to be triggered by a timer. I’m not really a Python guy, but if you work in C/C++, it is fairly trivial. Python has its own version of this someone else could help with. You’d need to state what programming language you are using combined with about how often you want to send. Also, you might mention if traffic in both directions is asynchronous, if each direction sends/receives one burst of data at the same time, so on. Basically, the use-case description.
Sir
The python program send the data to arduino uno through the code
“arduino.write((str(errorpan)).encode(‘utf-8’))”
And the Arduino uno receive it through
“while (Serial.available() == 0){}
float errorpan = Serial.parseInt();”
I want to send the data only one time in a loop when one of the servo reaches a position. After that it should pause . and again start in the next loop.
Please reply as soon as possible.
Someone else will have to help with python. However, does each end of the communications reply in any way to say “data received”? An acknowledge? If not, then send only when you have data to send, and when no receive data is available, but your buffer has content, send that to the application. Same thing at both ends: Data not available to send, then don’t try; data being received, then don’t send, but build your buffer, and when no more is available to receive, tell your application to use that data; if receive buffer is empty, then start polling to send again.
Basically, if something is received, don’t send, and you can figure that out by whether either (A) buffer has content received, or the serial port has something being received. The UART is one-way, not bidirectional, and it should work so long as you don’t start sending while receiving (you won’t want to mix the two).
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.