Go Down

Topic: Android Bluetooth joystick (Read 331320 times) previous topic - next topic

kas

#225
May 30, 2014, 11:58 am Last Edit: May 31, 2014, 05:12 pm by kas Reason: 1

For those who still have a Bluetooth card configured @9600bps, please add a one millisecond delay after the second "while(mySerial.available())"

Code: [Select]
void loop() {
 if(mySerial.available())  {
   delay(2);
   cmd[0] =  mySerial.read();  
   if(cmd[0] == STX)  {
     i=1;      
     while(mySerial.available())  {
    delay(1);                     //  <<mod     <-------------<<<
       cmd[i] = mySerial.read();
       ...........

}
 
This will prevent  while(mySerial.available())  to return before the complete data frame is received
I have modified AndroTest V1.4 to reflect this modification (now Version 1.41)

I only work @57600bps and never bothered checking lower data speeds  :smiley-red:
Thanks Topicja for bringing this point to my attention

A sweet thought for the Microsoft developers who deal with thousands different hardware configurations and get bashed by users because...  "it doesn't work on MY specific setup"   ;)

kas

#226
May 31, 2014, 12:56 pm Last Edit: May 31, 2014, 12:58 pm by kas Reason: 1
@n3kx
Quote
My problem was in bautrate

Glad it finally works  :)


Quote
and also you must press 3.rd button to get work .... so you overwrite setbuttonfeedback=false to  setbuttonfeedback=true and it work for my

:smiley-roll-blue: :smiley-roll-blue: :smiley-roll-blue:   setButtonFeedback was created for handling push buttons
This is a flag to send an earlier feed back to Android, for a consistent visual effect
setButtonFeedback is reset to False with each sendBlueToothData() call:
Code: [Select]
 if(setButtonFeedback == true)  {                      // allow momentary button visual effect
   previousMillis = currentMillis + 250;  
   setButtonFeedback = false;
 }

This code snippet could be safely omitted (will be removed in next release):

setButtonFeedback is misplaced and should be moved from Button #3 to Button #5 (push button)
I edited accordingly AndroTest V1.4 in response #212


kas

#227
Jun 01, 2014, 10:39 am Last Edit: Dec 18, 2014, 12:49 pm by kas
Quote
Please show me the way to check and configure my bluetooth card
thanks, Christian
Bluetooth cards come in a many flavors HC-05, HC-06, HC-07, HC-08 ...

I personally own an HC-06


and a very convenient Arduino/HC-05 combo



Configuration methods are quite different according to board type

For 57600 bps setup:
Code: [Select]
HC-05:        AT+UART=57600,0,0\r\n        (with linefeed + return)
HC-06:        AT+BAUD7                     (w/o linefeed + return)

The all point is to access the board configuration mode
My HC-05 board has a built in switch + reset button for easy operation (see above)

Arduino member Nick_Pyner has produced a very interesting document, I learned a lot from it
Don't forget to increase Nick's Karma by hitting the green "+" sign below his name

Complete AT command set:
HC-05
HC-06

Further readings here

Finally, I attach two sketches for configuring HC-05 and HC-06 boards


Enjoy the fascinating Bluetooth universe  ;)


@all
Feel free to post your personal experience and additional links


kas

Quote
Hello Kas,

First I would like to say thank you for the great piece of software you have written.  It has made implementing this type of controls into my project SO much easier.

I do have one question for you, but it would probably be better to give you a little background first...

I'm currently developing an autonomous mobile robot platform, with the UI to control it on an Android tablet.  I've developed most of the UI already for my device, and included a button that opens your Joystick BT Commander app directly from within my UI, for when the end user needs to manually control the robot.

However the Joystick BT Commnader app looks nothing like my UI design/theme, most notably you have a dark theme while my UI uses a "light" theme with a white background.

So my question for you is are you planning on implementing any sort of customization in this area into your app in the near future at all?  If not, is there some way that I can change the colors so our software would better compliment eachother?  I know I can go back and redesign my UI to match your app, but for my particular application (outdoors and/or in direct sunlight) a dark theme is a lot harder for the end user to see.

Thanks in advance for any assistance you can provide.  It is greatly appreciated.


Hi joepro
Thanks for the comments
Should be included in V5.0, to be posted within 4 weeks

jaapdemaat

Hi Kas,
Thanks for the great App!

Im having some difficulties implementing the code into my already excising code based on Miguel Grinberg tutorial (link below)
http://blog.miguelgrinberg.com/post/building-an-arduino-robot-part-iv-a-not-so-basic-robot-firmware
I was wondering if you are able to help me. If so, I can email you the code and explain more about the problem I got.
Obviously if we get it to work, we share it here for everyone else to use.

kas

Quote
I was wondering if you are able to help me. If so, I can email you the code and explain more about the problem I got.
Obviously if we get it to work, we share it here for everyone else to use


Hi jaapdemaat,
Let me have your email address via PM

billcat

Hi Kas,
I don't know if you have this info...I just installed Joystick BT Plus onto Kindle Fire HD 7" and it appears to be working from first impression :D
Bear in mind that I have not had a chance to test with the Arduino sketch, and sadly may not for some time, but look forward to doing so.
I just thought you may be glad to know this, I don't remember anyone else commenting on trying the app on Kindle.

From the screenshot, the buttons toggle green to white when pressed and the joystick data field in () changes with movement of the joystick, leading me to think the app is working correctly on the device.  The joystick is a bit far to the right and may interfere with the menu there, I am not sure yet.

Cheers, and thanks again for all the work you have done!


kas

Hi billcat   :)

Thanks for the info
I did know that Fire OS is based on Android, but I wasn't too sure it would work

Quote
The joystick is a bit far to the right and may interfere with the menu there, I am not sure yet

I can easily compile a "billcat's special" with fully visible joystick
Let me know  ;)

billcat



I can easily compile a "billcat's special" with fully visible joystick
Let me know  ;)

      :smiley-mr-green: :smiley-mr-green:
Greetings Kas, well I would feel too guilty to ask, considering all that you have helped out already. But I did get a chance to do very basic testing with the minimal Arduino/BT connections, and sad to confess that yes the joystick location did often interfere with that rightmost menu button,  causing an interruption of control over the stick.

Otherwise,  disregarding the fact that I haven't enough programming wits yet :smiley-red: to adjust the Arduino test sketch and thoroughly exercise all functions, it seems to be providing the appropriate responses via serial monitor when buttons are pressed, or the joystick moved!
I am quite pleased so far, I had doubts if it would work with the Fire, but it seems to be just fine.

As a side note....I was not able to connect to the HC-06 BT while the Kindle was connected to Wifi. I could not get BT comms working unless I disconnected the Wifi internet connection beforehand.  I don't know why, or if this is to be expected, but its not a problem for my purposes.

cheers XD

thornlv

Hi Kas.

Great work.I have read though all this thread and I find that your app is exactly what I am looking for, for my own project. At 55 I am getting interested in electronics and programming so I could knock up some 'Photoduino' stuff but I am not even passed the 'hello world' stage of programming.

My first project involves something I have had working for about a year now, as a wildlife photographer there are subjects which I can t get close to enough for some natural shots (mostly birds, mostly passerines)

I have a 'radio controlled' pan and tilt gimball tripod head and use this with a 'Cam ranger' WiFi setup - this allows me to control the DSLR settings through live view, focus and shoot from up to 100 feet away, the tripod has 2 servos controlling pan and tilt - But I use a rather cumbersome RC transmitter and a 7 inch tablet - the tablet runs the camranger app and works really well - the problem is the RC side of it - I want to control the pan/tilt with my smartphone.

I have got an Arduino Uno 3 and have run your demo app and every thing is fine there - serial monitor shows the actions as expected - but how do I control the servos - which pins to connect to, is there a sketch I could use or have i missed something ?

Vic (Birdincamera)

kas

Hi Vic,

First, congratulation for your very professional work
I went on your flickr gallery and I am impressed  :smiley-eek:  :smiley-eek:  :smiley-eek:



Back to your gimball project
It should basically operate as this pan/tilt demo project

Let me have a link to your tripod



kas

#236
Jun 12, 2014, 08:21 am Last Edit: Jun 12, 2014, 08:25 am by kas Reason: 1
@billcat
Quote
Quote
I can easily compile a "billcat's special" with fully visible joystick
Let me know   ;)
:smiley-mr-green: :smiley-mr-green:    
Greetings Kas, well I would feel too guilty to ask,


Check your mail  8)


@all
Please post a screenshot of the App
This will help me to optimize screen layout


john_lenfr

Hi,

I can't find the Total RC Commander apk on GooglePlay, is that normal?

kas

Quote
Hi,
I can't find the Total RC Commander apk on GooglePlay, is that normal?


https://play.google.com/store/apps/details?id=org.projectproto.btjoystick&feature=search_result

Just checked, still there  ;)


I should really change this V1.0 photo  :smiley-roll:

john_lenfr

[MODE FRENCH ON]
Ok, c'est bien l'appli avec le retour vidéo possible?

Je recherche comment tu as implémenter le retour vidéo? Est-ce qu'on peut utiliser du matériel FPV pour avoir ça ou bien ça doit forcément passer par le réseau? Et si ça doit passer par le réseau on doit utiliser quel matériel?
[/MODE FRENCH ON]

Go Up