The purpose of this exercise is to send the value read by the accelerometer and
gyroscope of B-L475E-IOT01A2 to a Python socket server hosted on Windows10.
python visual.py
- Start the server, modify the host name and port number if needed.
- build the image using main.cpp in the repository, modify the configuration
in mbed_app.json and the port number in main.cpp if needed, then the preparation is done.
- Move the subfolder of the example project of “DISCO_L475VG_IOT01-Sensors-BSP”
under “mbed-os-example-sockets”. - Modify the default port number to the port number opened on our server
- Modify the host name of the “mbed_app.json”
- Merge some of the code in the main.cpp of the sensor example into
the main.cpp of the sockets. including the sensor initialization part
and sensor value reading part - In the method run() of the class SocketDemo, We removed the part of sending
HTTP request and receiving HTTP response, then We added a while(1) loop to
implement sensor reading and sending data to the socket server. - For data visualization, we use matplotlib to visualize acceleration in three
dimensions.
In addition, we provide a three dimensional model to display the relative position
of the board. Moreover, we display the three dimensions of the gyro with three charts.