Answer the question
In order to leave comments, you need to log in
Arduino + Android real-time data transfer?
Transfer data from Android to Arduino using USB Host Shield.
The logic is this: Data is constantly sent from Android, and depending on the processing of the received data, the delay (x) function is executed on Arduino, where x is the calculated time. The problem is that after the delay, the Arduino receives the data that was sent before, and not the data that is being sent now.
Answer the question
In order to leave comments, you need to log in
After processing delay(), clear the receive buffer. Of course, this only applies if the data received during the delay() operation can be lost.
When new data is received, an interrupt should be generated, the handler of which should either transfer data to the main program (if it is free), or flush the receive buffer (if delay () is currently running).
Was the option considered when the PC starts sending data only as soon as Arduino reports that it is ready?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question