Slider thumbposition convert to integer

3,266 views
Skip to first unread message

Michał Łoś

unread,
Nov 9, 2014, 9:56:46 AM11/9/14
to mitappinv...@googlegroups.com
hi

i need convert slider position to integer and then send it as 1Byte number via bluetooth.
can some help me with this ??

Taifun

unread,
Nov 9, 2014, 10:04:00 AM11/9/14
to mitappinv...@googlegroups.com
It would really help if you provided a screenshot of your relevant blocks, so we can see what you are trying to do, and where the problem may be.

Taifun

Trying to push the limits of App Inventor! Snippets and Tutorials from Pura Vida Apps by Taifun.         

Michał Łoś

unread,
Nov 9, 2014, 10:50:25 AM11/9/14
to mitappinv...@googlegroups.com


when i run app and move slider i get "Error 510: Could not decode "55,37" as an integer."



Taifun

unread,
Nov 9, 2014, 10:54:34 AM11/9/14
to mitappinv...@googlegroups.com
use the round block 

round

Returns the given number rounded to the closest integer. If the fractional part is < .5 it will be rounded down. It it is > .5 it will be rounded up. If it is exactly equal to .5, numbers with an even whole part will be rounded down, and numbers with an odd whole part will be rounded up. (This method is called round to even.)

Taifun

unread,
Nov 9, 2014, 10:56:14 AM11/9/14
to mitappinv...@googlegroups.com
instead of using the evaluate but ignore result block, see here how to connect correctly
Taifun

Michał Łoś

unread,
Nov 9, 2014, 11:29:05 AM11/9/14
to mitappinv...@googlegroups.com
thx :)

Michał Łoś

unread,
Nov 9, 2014, 11:33:58 AM11/9/14
to mitappinv...@googlegroups.com

is the any chance to add encoder wheel as show on photo ??




Taifun

unread,
Nov 9, 2014, 11:56:47 AM11/9/14
to mitappinv...@googlegroups.com
yes, you could use an image sprite and the wheel as image, then depending on the rotation of the sprite you could extract the corresponding value

first do the tutorials http://appinventor.mit.edu/explore/ai2/tutorials.html to learn the basics of App Inventor, then try something and follow the

SteveJG

unread,
Nov 9, 2014, 1:39:39 PM11/9/14
to
Make a control using an AI2 Canvas.

Here is the concept... I R an Engineer, not an aRtist so bare with IT.   If you are Neet, it won't Bee soooo messy.
Have fun.

You probably don't want to copy all this stuff so try the aia.   Mind the settings on the Design screen and realize, you can fix this up in many different ways.  You can change the "Volume" by touching the dial or by using the buttons ..... oh my, there is not any error control.... don't get burned, when u do it, do it right.

Oh no, you wanted an encoder wheel.    No problem, change the caption to Encoder and then change some blocks so that a change in position for certain 'values' will be the Bluetooth script you need.    

Does that work?  When your are done, please think about showing how this would look with good artwork?


Regards,
Steve
Make_A_Control.aia
Reply all
Reply to author
Forward
0 new messages