output value only if it differs from last one ("flickering" output)

Jan 17, 2010 at 11:32am

output value only if it differs from last one ("flickering" output)

Hi all,

i’m having issues with the use of an accelerometer which reports me some “flickering” values.
In every position (even still ones!) it will output very quickly two different values (e.g. 0.1, 0.3, 0.1, 0.3 0.1, 0.3).
This is the reason why I can’t use [change] object, for it will “always” give me a change!
do you know a way to solve this out?
thanks much!

#47807
Jan 17, 2010 at 12:09pm

why 2 values?
does it provide x & y ?

what do you need to detect? an x or y change?

I could do something for you but I’d need some infos..

#171940
Jan 17, 2010 at 12:36pm

I did that:

– Pasted Max Patch, click to expand. –

I hope it could be a solution for you.
if one of the two values change, it fires the 2 current values.

#171941
Jan 17, 2010 at 2:10pm

You could use [bucket] to compare the current value with the prious one using an [if]. There’s a simple example below. The [lbyl] object from CNMAT might be useful too. For data smoothing have a look towards the bottom of this thread for a number of different approaches.

lh

– Pasted Max Patch, click to expand. –
#171942
Jan 17, 2010 at 4:00pm

thanks much guys.
Luke solution was what I was looking for! danke!
for julien: from an accelerometer i can have x, y and z values “isolated” and use them for different things.
sensor’s output, being analogic, can be very irregular and give you a stream of values you don’t really need: that’s the reason why it’s useful to “filter” the output and use it only if a difference threshold is obtained: that is exactly what luke patch is doing. again: thanks all!

#171943
Jan 17, 2010 at 4:38pm

ok great !
I misunderstood the question.
The important thing: you found your solution :)

#171944

You must be logged in to reply to this topic.