Android Question Knob RPM

GabrielM

Member
Licensed User
Longtime User
Hi,

Looking for an advice on the following:

I have an endless rotating knob view based on Informatix tutorial and would like to measure the rotational speed of the knob. Lets say from a minimum value of zero when the knob is not touched to a Max value of 100 when you make 3 complete knob turns (i.e. 3 x 360 deg) per second.

Any hint on how to come up with a speed related variable based on 1 degree of travel for example, not for each complete knob turn (i.e. 360 deg)?

Thank you
 

Mrjoey

Active Member
Licensed User
Longtime User
try this :
B4X:
Dim FirstValue As Int = 1
            Dim LastValue As Int = 100
            Dim Ratio As Float = (MaxAngle - MinAngle) / (LastValue - FirstValue)
myvalue  = Round((Angle - MinAngle) / Ratio + FirstValue)
this code gives u values from 1 (angle = -135degree) to 100(angle = 135 degree)
now u will add some indicators to see how much "100" was hit and u add +1. hope it helps u.
 
Upvote 0

GabrielM

Member
Licensed User
Longtime User

@Mrjoey
Much appreciated, will try this as well, though what I try to do is continuous (endless) rotations not bound by a min or max and count the hits on each degree, and read that value on a timer/ticker.
Thank you
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…