Skip to first unread message

jeneral

unread,
Sep 20, 2014, 9:59:13 PM9/20/14
to mitappinv...@googlegroups.com
hello all..

can someone help me how to send analog signal (0-255) from android to arduino by using slider via bluetooth..

i want to change my motor speed..

for now, i only made to send a value to the arduino (digital write) using button function

could you please provide the simplest method cause i have search the entire group but i dont understand.

SteveJG

unread,
Sep 23, 2014, 8:50:56 PM9/23/14
to mitappinv...@googlegroups.com
Try the following code.   You need a slider and a label.



This will provide 0-255    (but possibly skip a few digits...I did not test thoroughly

You know how to deal with single values to BlueTooth ... just substitute the label1.text .

To get precision (0 to 255) in discrete values, you could use three sliders.  The first providing the first digit (0,1, or 2), the second providing 0 through 9 and the third also 0 through 9 (but not allowing 6,7,8 and 9 if the second digit is a 2.  Save to label1, label2, label3   as string values (not the Math).    then join label1.text + label2.text + label3.text    to get 025, 157 etc.

If you are just interested in changing the motor speed with the slider, the Block code will work fine.

Did this work for you?

Regards,
Steve

jeneral

unread,
Oct 5, 2014, 10:11:44 AM10/5/14
to mitappinv...@googlegroups.com
sorry take long time to reply..

i actually have attached the bluetooth module on the project and cannot test it now.

so, if i want to keep sending the value whenever I changed the position, can I make it like in the picture below. just to get your idea


Reply all
Reply to author
Forward
0 new messages