Now you're ready to write a code on your Raspberry Pi to read the accelerometer on your smartphone. The code will output accelerometer values on the x, y, and z axes of the smartphone or tablet in m/s2:
- Modify the main.cc file with the source code listed in Listing 6.1:
Listing 6.1: Reading the accelerometer on the smartphone
- Then, save the file and exit the nano text editor by pressing Ctrl + O, followed by Enter, followed by Ctrl +X.
- Build the project with the following command:
pi@raspberrypi:~/blynk-library/linux $ ./build.sh raspberry
- Then, run the program with the auth token associated with your Blynk project:
pi@raspberrypi:~/blynk-library/linux $sudo ./blynk --token=ca7bed1c92214503a65de8e20164994f ...