discrete versus scrolling XY values; Brendan's stuck

Apr 13, 2011 at 1:41pm

discrete versus scrolling XY values; Brendan's stuck

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. –
#56292
Apr 13, 2011 at 3:10pm

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

– Pasted Max Patch, click to expand. –
#201997
Apr 13, 2011 at 4:19pm

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. –
#201998
Apr 13, 2011 at 5:12pm

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

– Pasted Max Patch, click to expand. –
#201999
Apr 13, 2011 at 5:43pm

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

Brendan

#202000
Apr 13, 2011 at 5:49pm

this appears to work like a charm……thanks again

Brendan

#202001

You must be logged in to reply to this topic.