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

    Jan 17 2010 | 11:32 am
    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!

    • Jan 17 2010 | 12:09 pm
      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..
    • Jan 17 2010 | 12:36 pm
      I did that:
      I hope it could be a solution for you. if one of the two values change, it fires the 2 current values.
    • Jan 17 2010 | 2:10 pm
      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.
    • Jan 17 2010 | 4:00 pm
      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!
    • Jan 17 2010 | 4:38 pm
      ok great ! I misunderstood the question. The important thing: you found your solution :)