Filtering only big changes (Processing)

PaulS:

inByte[0] = float(inputStringArr[0])-600; 

inByte[1] = float(inputStringArr[1])-600;
inByte[2] = float(inputStringArr[2])-600;
inByte[3] = float(inputStringArr[3])-600;
inByte[4] = float(inputStringArr[4])-600;



What does the sending code look like? Why are you adding 600 to the value before converting it to a string?

On every call to serialEvent(), you are making a copy of the values in inByte in the new array inByteOld. There is nothing there to compare the new values to, so if the value is greater than 50, the difference will be too.

inByteOld needs to be global.

the sending code looks like

893 751 981 943 1023
878 741 981 943 1023
866 767 981 943 1023
887 748 981 943 1023
869 736 981 943 1023
906 760 981 943 1023
876 740 981 943 1023
888 748 981 943 1023
888 749 980 943 1023
897 755 980 943 1023
858 760 980 943 1023
871 737 979 943 1023
897 754 984 940 1023
. . ETC

I am subtracting 600 from each value since all the numbers are in the +700 range and my graphing window is 800x600 (so if I dont substract the values the whole screen is colored). since all the values oscilate above 600, thats why I subtracted 600.
(with commas instead of spaces)
so far I only have the first 2 channels connected (thats why the last 3 dont really move)

thanks, i'll try the global variable.

PeterH:

Quick_questions:
I am getting really ugly signals that just go up and down, but only in small differences, so what I wanted to do is to tell the sketch "only change the value if it is over a +/- 50 threshold"

One option is to smooth the incoming signal. An exponential decaying average is very easy to code and quite effective for things like this. The algorithm is:

smoothed = ((weight * smoothed) + newSample) / (weight + 1);

I'm sure you get the idea.

actually I dont get the idea, could you elaborate?