2016년 11월 27일 일요일

Joystick BT


hey guys,do you mind taking a look at my app? i want to actually send joystick data via bluetooth? what should i do. I attached my aia file below. Please help.


-- 
What do you expect as an anwer?
First of all, you should give some more information about your joystick.
At first I thought that you wanted to connect a joystick to your phone, but on closer look I think that you want to use your phone as joystick.
What is it?
In the latter case, you need to set up your phone as Bt server, not as client. And where do you want to connect it to? A PC? Another phone?
In the second case look at the BT example of Taifun: https://puravidaapps.com/btchat.php
Of course it is not your problem, but it shows how to set up the communication.
Cheers, Ghica.


btchat.aia

-- 
Ghica, thanks a lot for responding.
I want to use my phone as a joystick. I want to control two servos for pan/tilt of a camera to be exact. As of now, I am stuck at wondering how to send joystick data to actually control 2 servo motors.

-- 
so i should set it as a bt server? is that right? I'll post an update. Do you mind helping me out in this one? Thanks a lot

-- 
That depends if it is right. But this knowledge will not help you if you do not know what the servo motors expect by way of input. And how they produce output to pan/tilt that camera. Are the servo's attached to an Arduino or comparable board? In that case, you still need to be a BT client, but your implementation is still wrong, because in your app there is no communication that I can find to command those servo's.
Cheers, Ghica.

-- 
yes, the servos are connected to arduino. btw, i am using hc-05 bt module to send data from the smartphone to arduino.

yes Ghica, in my app there's no communication to command servos, not yet. It is because i do not know what to do. I was only able to move the joystick, that's it. I don't know what command to use or block to initiate to begin bluetooth comms.  I was wondering if you could try to direct me to some useful links or teach me how to do it, Thanks :) 

-- 
Here are some useful links:

http://appinventor.pevest.com/?p=520
http://www.martyncurrey.com/turning-a-led-on-and-off-with-an-arduino-a-hc-06-and-android/


Try these. If you have further questions then, report back here.
Cheers, Ghica.

-- 

thanks Ghica, i'll look into these immediately. One last question. Do i need to convert joystick data to ASCII before transmitting it to the arduino? 

-- 
That totally depends on the sketch you wrote for the Arduino. This is the difficult trick about BT to Arduino connections that there is too much freedom.
I find it easiest to send one character strings to the Arduino and have a sketch that understands those. I think there are examples in the tutorials I gave you links to.
Cheers, Ghica


--

thanks a lot for the attention Ghica I will work on these and post updates probably after a week. Really, I appreciate it. 


-- 

댓글 없음:

댓글 쓰기