how to detect clockwise counterclockwise

Feb 12, 2012 at 3:18pm

how to detect clockwise counterclockwise

hello

i would like to be able to detect direction of spinning on a touch controller.

the problem happen when i cross the 0, even i turn clockwise its interpreted as counterclockwise.

please take a look at this very small patch

– Pasted Max Patch, click to expand. –
#61733
Feb 12, 2012 at 4:04pm

you could build in a check in the range around 0, pseudocode:

IF previous_value equal (or close) to 127 AND new_value equal (or close) to 0 THEN clockwise

and vice versa

or for example catch a value jump < = -120 and interpret it as clockwise turn

#222883
Feb 12, 2012 at 6:02pm

thanks a lot for your time.
i try both ways that you show me.
heres s the smallest one. for sure it could be smaller and cleaner but it already do the job very well.

– Pasted Max Patch, click to expand. –
#222884

You must be logged in to reply to this topic.