how to detect clockwise counterclockwise

herrmutt's icon

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.

Max Patch
Copy patch and select New From Clipboard in Max.

please take a look at this very small patch

dtr's icon

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

herrmutt's icon
Max Patch
Copy patch and select New From Clipboard in Max.

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.