Joystick Modes and Sending Data Over Bluetooth
There are two joystick modes. Default and Simple Joystick:
*** Remember – the Free version will send the number 9 for all joystick (Default/Simple) and Command Buttons. The Pro version will send actual values.
Default Joystick Mode:
When you move the ball around, coordinates are generated as X+/- and Y +/- and can be used to interpret both velocity and direction. These are packaged and sent in the following format: sX=val,Y=vale i.e. sX=75,Y=55e where ‘s’ indicates the start and ‘e’ indicates the end. In this mode, when you press a Command Button, values are sent in the following format: sC=[val]e (i.e. For Command #2 sC=2e is sent) where ‘s’ indicates the start, ‘C’ indicates it is a command button, ‘2’ is the value that you want to parse and ‘e’ indicates the end. These values can be parsed to have your robot move and perform additional tasks. (sample Arduino code provided at link below)
Simple Joystick Mode:
In Simple mode, you tap the arrows which generate single character values depending on the arrow you tapped (i.e. the top arrow sends U). Values generated are: U (up), D (down), L (left), R (right). Tapping the center of the joystick sends an S value (stop). Tapping any of the command value sends the respective command number. i.e. tapping Command Button 3, sends 3. In this mode, your micro-controller code can be simplified as need only parse single character values.In this mode, when you press a Command Button, values are sent as single characters in the value of the Command Button. i.e. If you press Command Button 3, the value 3 is sent. (sample Arduino code provided at link below)
You can change between Default and Simple modes in the Settings section.
There are two example Arduino programs – one for Default mode, and one for Simple mode. They have routines built into them to parse the values being sent over Bluetooth and performing motor actions.
Posted in: BTBotControl - FAQ