EZ Bluetooth in ***C*** and a nice App
Wildatheart
Posts: 195
Although this thread could nicely find its' home in any one of several of our forums I've decided to post it in the catch all container to cover all possible options.
A few days ago Tom (twm47099) began a thread in the Wireless forum that combined the Quickstart board and a Bluetooth device. http://forums.parallax.com/showthread.php/154413-RN-42-Bluetooth-with-Prop-Quickstart-board-(Simple-IDE-C-program) His sample C code and the Sena BT Term App worked perfectly.
With Apps, Apps, and more Apps everywhere I set out to look for an App with an intuitive graphical interface. In the process I settled on an App written by our old Parallax friend, Kas. http://forums.parallax.com/showthread.php/104605-Balancing-robot-using-Memsic-2125-accelerometer
There is a very detailed easy to understand discussion of his BT Commander App over at the Alternate Universe http://forum.arduino.cc/index.php?topic=173246.90 After seeing his work I'm sure you'll flood his PM mailbox with encouragement to return to the 8X Universe.
Below are photos of my experiment... They show a QS board with 8 built-in LED indicators for easy testing and proof of concept. The BT Commander App is running on an LG G2 Android phone, the Bluetooth EZ link Bluetooth device is attached (I'm sure other BT devices will also work), and a Parallax continuous rotation servo is wired to the QS. The BT device, small perf board, and battery are Velcro(ed) to the back of the QS to make the experiment very portable.
The 4 buttons are programmed to toggle 4 of the QS LED's and the remaining 4 LED's display the position of the stick in each of the 4 quadrants of the joystick image. The servo is programmed to respond to the joystick position and any sequencing of the servo rotation can be modified with additional input from the 4 buttons (or the buttons can be used for other control functions).
C code could be included here, but Tom's previously posted code in the link above works just fine and can be tweaked according to Kas' very detailed discussion of BT Commander, also in the link above.
A few days ago Tom (twm47099) began a thread in the Wireless forum that combined the Quickstart board and a Bluetooth device. http://forums.parallax.com/showthread.php/154413-RN-42-Bluetooth-with-Prop-Quickstart-board-(Simple-IDE-C-program) His sample C code and the Sena BT Term App worked perfectly.
With Apps, Apps, and more Apps everywhere I set out to look for an App with an intuitive graphical interface. In the process I settled on an App written by our old Parallax friend, Kas. http://forums.parallax.com/showthread.php/104605-Balancing-robot-using-Memsic-2125-accelerometer
There is a very detailed easy to understand discussion of his BT Commander App over at the Alternate Universe http://forum.arduino.cc/index.php?topic=173246.90 After seeing his work I'm sure you'll flood his PM mailbox with encouragement to return to the 8X Universe.
Below are photos of my experiment... They show a QS board with 8 built-in LED indicators for easy testing and proof of concept. The BT Commander App is running on an LG G2 Android phone, the Bluetooth EZ link Bluetooth device is attached (I'm sure other BT devices will also work), and a Parallax continuous rotation servo is wired to the QS. The BT device, small perf board, and battery are Velcro(ed) to the back of the QS to make the experiment very portable.
The 4 buttons are programmed to toggle 4 of the QS LED's and the remaining 4 LED's display the position of the stick in each of the 4 quadrants of the joystick image. The servo is programmed to respond to the joystick position and any sequencing of the servo rotation can be modified with additional input from the 4 buttons (or the buttons can be used for other control functions).
C code could be included here, but Tom's previously posted code in the link above works just fine and can be tweaked according to Kas' very detailed discussion of BT Commander, also in the link above.
Comments
Appreciate your help.
Tom
can be used to control other than the servo functions. This will certainly give you a place to start.
Failed to mention - Kas' great App is FREE!
Data from App is always framed with:
STX is always 2
ETX is always 3
3 or 6 bytes are transmitted:
(STX byte ETX)
> is always a button press
(STX high-byte-X low-byte-X high-byte-Y low-byte-Y ETX)
> always joystick values
Thanks, I was confused that his c code made use of STX and ETX. I thought that the fdserial library used those values as part of the rx and that we didn't have access to them. (That's a problem when reading code w/o being able to actually run it.) I will set my QS with a couple of servos and give it a try. Then I'll try to translate it to forth (pfth) and spin.
Thanks again,
Tom
Since the RN-42 defaults to 115,200, I'll try that first. I know for my previous program that worked. I'm not sure if it will work that fast receiving a string of data.
Tom
The details are in the header comments of the C program below.
Tom