rotary encoder. up down object

Jimmeh's icon

hello all, im using an arduino with a rotary encoder into max, basically ive got digits going up one way and down the other. is there an object that can recognize the up and down movements? i think ive seen one but wasn't too sure..

cheers

Chris Muir's icon

On Mar 18, 2008, at 4:46 PM, James wrote:

>
> hello all, im using an arduino with a rotary encoder into max,
> basically ive got digits going up one way and down the other. is
> there an object that can recognize the up and down movements? i
> think ive seen one but wasn't too sure..

You could cobble a solution together using either counter, accum, or
IncDec (and probably several more that I'm forgetting. They each have
the plusses and minuses.

IncDec is the easy answer, but something based on counter might give
you a more flexible solution.

Chris Muir
cbm@well.com    
http://www.xfade.com

Jimmeh's icon

is there not an object that can recognize if the number value is going up or down?

Steven Miller's icon

You could easily make an abstraction using [expr] or separate
comparison operators (i.e. , =, etc.) to compare the value of the
current input with the value of the previous input.

On Mar 19, 2008, at 11:19 AM, James wrote:
>
> is there not an object that can recognize if the number value is
> going up or down?

----
Steven M. Miller
Professor, Contemporary Music Program
College of Santa Fe

Home
SFIFEM
Atrium Sound Space
OVOS
CMP

Chris Muir's icon

On Mar 19, 2008, at 10:19 AM, James wrote:

> is there not an object that can recognize if the number value is
> going up or down?

Detecting whether a number is going up or down is trivial, but I don't
think that that's really what you want.

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

What is the arduino actually delivering? Some sort of delta based on
number of clicks of the encoder? Is it a positive number if CW, and a
negative number if CCW?

Chris Muir
cbm@well.com    
http://www.xfade.com

Francois Weber's icon

[change +] and [change -] are your friends ...

Jimmeh's icon

actually it turns out im having some troubles in the arduino code, has anyone got one of these working in max?

notyouraveragejoe's icon

I've been using an arduino board with max happily, my current project
involves controlling 4 servo motors through a max patch.
I also did a project involving sending 6 integers to max from the analogue
inputs on the arduino.

I would guess that you should get as much as you can right at the arduino
side of things before trying to tackle it in max. Maybe you could have two
variables in the arduino code, for comparing the current and previous inputs
from the optical encoder, and sending the difference to max, so -1 would
indicate a negative direction and 1 a positive direction, and larger numbers
may indicate some sort of force/speed.

Do you have any specific questions pertaining to the arduino code?

On 06/04/2008, James wrote:
>
>
> actually it turns out im having some troubles in the arduino code, has
> anyone got one of these working in max?
>
>

distressor's icon

-1 would indicate a negative direction and 1 a positive direction, and larger numbers
may indicate some sort of force/speed.

This is precisely what i am looking for.
Especially the part with higher values for speed.
Could anyone share some Arduino code like this?

I am new to Arduino and not a good coder in general.
The encoder i'd like to use is a US Digital S1-512-B.

I get some values into Max via the serial object. Is this a good way to do this?

Thanks