Spring 2016 RoFi: Bluetooth Communication
Christopher Andelin (Project Manager)
Mario Ramirez (Systems Engineer)
Qui Du (Manufacturing Engineer)
Andrew Laqui (Electronics and Controls Engineer)
Henry Ruff (Electronics and Controls Engineer)
Bluetooth Communication
Mario Ramirez (Systems Engineer)
To meet requirement 1.8, RoFi must communicate with the Arxrobot App and have an on and off state using the users phone. Begin your Bluetooth connection by downloading the Arxrobot firmware, https://github.com/arxterra/BiPed-Robot. This code has the commands and command decoder subroutine to control RoFi using the Arxrobot app.
First, connect and setup your Bluetooth mode, HC-06. The pass code for connecting to the module with your phone is ‘0000’.
Within the Arxrobot firmware a custom command will be made.
To initially test the custom command, a simple LED on and off command will be implemented within the command decoder subroutine.
Once proper Bluetooth connection is tested, change the implemented command to your desired action. For RoFi, we created a trigger after the command is received.
When the command packet is sent, the code will then read the 3rd byte. If the byte is HIGH it will set trigger to HIGH. If the byte is LOW it will set trigger to LOW. Using this trigger variable, an “if” statement was implemented into our main loop code.
Figure 6 shows two “if” statements for different values of the trigger. When the trigger is HIGH, it will light an LED and put RoFi into an Update Action subroutine which allows RoFi to update to its next frame. When trigger is set to LOW, RoFi will not take any action and will remain at its current frame until trigger is set back to HIGH.