Hi,
I want to send one byte number in rounded form to Bluetooth device. i have applied a round block to the slider component. as the number of steps are only 100 and my maximum value is 255, how to map it to the slider steps?
it is like this:
255/100 = 2.55 which is rounded to 3 and (3*85)= 255. so do i need to set slider number of steps to 85 only to map it correctly!.
You are rounding too early in your calculations.
Since the rounding is to fit the number into the byte value range, it should be done at the last moment before going into a byte.
This keeps the most precision for the division and multiplication steps, which need precision.
What is the difference between sending a number like this:
and sending a number like this
That depends on the generosity and forgiveness of the block doing the sending.
It may or may not coerce the number to text if it wants to send text.
It may or may not coerce a text block with a number to a number in a byte value if it wants to send byte values.
Check the tool tip of the block.
Also, if you have not seen one yet, look into how ASCII tables work.
Character '1' is byte value decimal 49.
Divide the total range by the step size:
(Max - Min) / Step size = Number of steps
Thankyou for this nice post, I was more or les aware of this table and its working. But here I wanted to know whether "1"is treated as a character or a decimal member. Now this got refreshed in my mind that it will be treated as a character if placed in a text block. Thanks..
hi,
Thankyou for your reply . Do you have some idea of how to set slider range to send numbers from 0 - 100 through bluetooth and dead block all other number form 101 - 255.
Use the math min block.
You want to send min(thumb,100)
In my djslider extension i have a block to set min and max range of the slider. Doesnt this fullfill your needs? [FREE]DjSlider extension
Ps: why do you started 2 threads with the same issue?
Edit: oh, i noticed that i suggested you my extension already 6 days ago via pm,