Go Down

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

geeameal

I posted a pan/tilt project based on Joystick Bluetooth Commander, in the Robotic Section


hey @kas, for this to work, do i need to change my bt baud rate to 57600?

kas

Hi geeameal,

A bit busy for the moment  :-\

This is Andro_Pan_TiltV36.ino
You may adjust  Serial.begin(57600)  to the actual speed of your board
For reliable results, I suggest you change your BT board to 57600 bps

Servo's are connected to pin #9 & #10
Use a separate power supply and connect grounds

Good luck



fullspool

I am not sure what happened to my uno but I replaced it with a new one and all appears to be working well now . Will do further testing tomorrow.

Dont pay attention to the wiring mess :)

https://youtu.be/ZnvvJ4H68iQ

Kas is there a way to peogram a dead mans cut if it sees over 100 amps and if it gets below 20 volts it will sound off a buzzer?

thanks for the help guys!

kas

Nice job, impressive   :smiley-eek-blue:  :smiley-eek-blue:  :smiley-eek-blue:

Try to figure what happened to your UNO, to avoid getting another fried one shortly  ;)


kas

#814
Nov 22, 2016, 08:14 am Last Edit: Nov 22, 2016, 08:16 am by kas
Im using MEGA 2560 clone with the MEGA sensor shield V2.0 clone.
Bluetooth HC-06 Clone.
could you point me to the correct downloads to get this app working with servos?
Hi Shadowbuddy518
Sorry for the late response
You can use  Andro_Pan_TiltV36.ino  (see above post #811)
With a Mega 2560, I suspect you have more than enough I/O's

You can test communication using  AndroTest V2.0 (post #256)
Don't forget to adjust sketch/BT card baud rate
Let us know how it works


geeameal

I posted a pan/tilt project based on Joystick Bluetooth Commander, in the Robotic Section


hey mate, what software did you use for this android app? I want to recreate this app, but i want to remove the buttons, leaving the joystick only. Is it possible to do it with app inventor?

geeameal

Easy to do... let's see...
Android programming is a fascinating universe
Three very different approches are available on the market, with increasing learning curves
App Inventor
A full graphic cloud based application, just fitting together puzzle pieces
still in development, very intuitive but a bit limited for the moment

Basic4android  
using a syntax MS Visual Basic syntax, creates native Android applications

Eclipse + Android SDK
for full blown applications, a bit frustrating at startup  :smiley-eek: :smiley-eek: :smiley-eek:
A first experience with Java will definitly help
Tons of help and snippets, at XDA developpers
lots of tuto's on Youtube

I tried App Inventor and finally choosed the hard way... 8)
Thanks for this excellent feedback :)

Out of curiosity, where is the Land of sun+snow ??
can i recreate this app using app inventor?

kas

Is your App up and running now ??


Quote
I want to recreate this app, but i want to remove the buttons, leaving the joystick only
In  <Option>  you can reduce button numbers and remove data fields


Quote
can i recreate this app using app inventor?
Probably  ;)



SMM2

Hi, I have just downloaded your app and have a question.
I'm just trying to understand how to interpret the data I receive from the app in the Serial Monitor.
I have attached a screenshot of the Serial Monitor below, and I'm wanting to understand what these values here mean:
Code: [Select]

2
50
48
48
50
48
48
3


And how they correspond to the XY coordinate displayed in the app.
"Success is not built on success. It's built on failure. It's built on frustration. Sometimes its built on catastrophe."

geeameal

Is your App up and running now ??

In  <Option>  you can reduce button numbers and remove data fields

Probably  ;)



as of now, i can move the joystick freely, but it's not yet able to send any data to control the servos. by the way, did you use eclipse for this apk ?

geeameal

Is your App up and running now ??

In  <Option>  you can reduce button numbers and remove data fields

Probably  ;)



hey kas, do you mind taking a look at my apk progress? see if there's anything i should add or change?

SMM2

Would anyone be willing to help with post #818?

Any help would be great :)
"Success is not built on success. It's built on failure. It's built on frustration. Sometimes its built on catastrophe."

kas

#822
Nov 26, 2016, 09:48 pm Last Edit: Nov 26, 2016, 10:04 pm by kas
Would anyone be willing to help with post #818?
Any help would be great :)

Code: [Select]

2
50
48
48
50
48
48
3

Let's try  ;)
First, check communication protocol

for X=0,   Y=0
Data frame is:   <0x02 0x32 0x30 0x30 0x32 0x30 0x30 0x03>
in decimal: <2 50 48 48 50 48 48 3>

 32 hex (decimal 50) is Ascii '2'
 30 hex (decimal 48) is Ascii '0'

in ASCII: <STX '2' '0' '0'  '2' '0' '0' ETX>
               <STX  "Joy_X + 200"  "Joy_Y + 200"  ETX>   (Offset to avoid  transmitting negative numbers)

To convert to actual joystick coordinates, use this code snippet from  AndroTest V2.0

Code: [Select]
void getJoystickState(byte data[8])    {
  int joyX = (data[1]-48)*100 + (data[2]-48)*10 + (data[3]-48);       // obtain an Int from the ASCII representation
  int joyY = (data[4]-48)*100 + (data[5]-48)*10 + (data[6]-48);
  joyX = joyX - 200;                                                  // remove Offset
  joyY = joyY - 200;
 }






kas

Quote
as of now, i can move the joystick freely, but it's not yet able to send any data to control the servos.?
Can you connect to your BT card ??


Quote
by the way, did you use eclipse for this apk?
Yes


Quote
hey kas, do you mind taking a look at my apk progress? see if there's anything i should add or change?
Sorry, no spare time



geeameal

Can you connect to your BT card ??


Yes

Sorry, no spare time



can you sned me the code for the apk instead?

Go Up