Bluetooth communication with M5Stack
It is a method of Bluetooth communication of M5Stack
Based on this article, I am checking the method.
I want to exchange data with other terminals
For example, you can communicate with devices such as iOS via Bluetooth.
This time, the pattern is to use M5Stack as the master unit and other devices as the slave unit.
Import the required libraries.
Describe the properties required for Bluetooth communication
The characteristic for sending with the server,
the Bool value for checking the connection status, and
the UUID for communication are set.
You can generate a unique user ID on a website called uuidgenerator.
Initial settings for Bluetooth communication
After writing the callback function of the connection status and the callback function when it is received,
the initial setting of communication is performed.
We set up a server, create a communication service, and create characteristics for sending and receiving from the service.
The UUID is registered in the characteristic at the time of transmission and reception.
Then start advertising the communication.
Check the connection status
We call the following code in loop () to check if the callback has changed the
connection, and if the connection is lost, we are advertising again.
Call the following in loop () to send the data.
String is sent as an array of Character.
I’m a freelance engineer.
Please feel free to contact us with a brief development description.
I am making an app that uses Core ML and ARKit.
We send machine learning / AR related information.