Forums > MaxMSP

discrete versus scrolling XY values; Brendan's stuck

April 13, 2011 | 1:41 pm

Hi
I have hacked a touchpanel and, using Arduino -> [serial], I’ve got some fairly stable XY values coming in to Max. I wanted discrete and instantaneous location values – touch somewhere, release, touch again; a brief conversion to the signal domain and a [snapshot~] object does this perfectly. However, before the signal domain conversion, I have ‘continuous’ XY data, a tiny little bit noisy but usable, which allows for ‘click-drag’ functionality, or scrolling values. How can I tie these two modalities together in Max, without losing the discrete instantaneous touch data? What I desire is rock solid location data, and the ability to drag/scroll.

pseudo-code:
if the number attains it’s maximum and doesn’t change for N milliseconds then it is discrete…..
if the number does change (over N or M milliseconds?) then it is continuous

haaaalp
Brendan

patch below

– Pasted Max Patch, click to expand. –

April 13, 2011 | 3:10 pm

Hi Brendan.
This might get you started – if I have understood your question!
hth
aa

– Pasted Max Patch, click to expand. –

April 13, 2011 | 4:19 pm

Hi Andrea
thanks for your elegant solution; it addresses one element of my question, which I may not have described very well:

I have a number stream from a touchpanel, which sharply rises (< c.20ms) to the correct X and Y value when the panel is touched. Using an averaging function in Arduino has cleaned up much of the data noise. To capture discrete values I simply use a [togedge] bang and [snapshot~]. This works perfectly well; however, I would also like to be able to use the continuous data from dragging across the touchpanel: as expected, the [togedge] bangs once and lets through a discrete value, not the continuous one...I have attached a small patch demonstrating the issue,

thanks again

– Pasted Max Patch, click to expand. –


MIB
April 13, 2011 | 5:12 pm

don’t know if this is helpful at all… works with the trackpad ;)

– Pasted Max Patch, click to expand. –

April 13, 2011 | 5:43 pm

Hey thanks MIB
not at Max at the moment, but i’ll have a look asap

Brendan


April 13, 2011 | 5:49 pm

this appears to work like a charm……thanks again

Brendan


Viewing 6 posts - 1 through 6 (of 6 total)