Bluetooth timings

I've looked at various tutorials for Arduinos / Bluetooth (HC05) / MIT App Inventor (or similar) and none of the seem to discuss timings.
(I don't have specific code to share - this is just trying to understand principals at the moment.)

In each tutorial, the Arduino performs a Serial.print() at some point in the sketch, and the Android app checks for data periodically. The timings do not seem to need explicit synchronisation.
Presumably there's some sort of sync-ing going on, either when the server and client are paired, or periodically, or both. But other than that, I can't see how you know the "send" and "receive" will coincide. Maybe, once the HC05 receives data from.the Arduino, it transmits that data until it's told not to ... bit that seems unlikely. Or maybe the data is transmitted until it is received ... more likely.

I've done some searching on this, but have not found a simple answer. Help?!
(Be gentle with me, oh wise and patient uber_geeks. I am, like Pooh, a bear of very little brain.)

An HC05 just passed through whatever is sent to it over a wireless connection once it is paired and connected to the app on the end opposite the Arduino. It is up to the software on the Arduino and the app to maintane "synchronization". One way that that is done is with start and end markers within the data packet as done in example #3 of the serial input basics tutorial.

Does that answer your question?

Android app checks for data periodically.

That is not entirely true. The Android app is listening constantly (as is the serial port on the Arduino). Whenever a byte is available it is recorded in a receive buffer to be read at the convenience of the program.

On the Arduino side, data is written to a transmit buffer and is then sent out through the HC05, in the backgruound, until the buffer is empty.

Ah ha!
So once the Serial.print() happens, the data is received by the Android device (almost) straight away.
But the app itself doesn't access that data until buletooth.read (or whatever it's called) pulls the data from the respective buffer?

The HC05 is like a modem. It just takes serial data and modulates it onto a RF carrier to send and demodulates the RF carrier to receive.

On the Arduino side, yes. I can't say about the receiving device and its app.

Thanks.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.