I am using serial.write to send data from 12 diy FSR's - to MaxMSP - and I recently learned from a more experienced colleague that it is common practice to send data only when it changes. This sounds attractive. Would it simply be a matter of writing the following:

Yes, I tried my own example and my 'sent' data is unreliable. As my FSRs are homemade, the raw values fluctuate from c.120 (+/-5) to c. 800 (+/-5) so I was using [map] and [constrain] quite heavily to force the inactive value down to zero. Could I ask for further help in applying a delta function; this way I can send data only when the delta exceeds a set threshold.

void loop(){ currVal = analogRead(myPin); if(abs(currVal - prevVal) > 5) { Serial.write(currVal); prevVal = currVal; }}This will send a value only when the difference between the current value and the previous value is greater than 5, positive or negative.

You might want to divide the fsr reading by some amount, say 5, and then send each (different) value without worrying about a range. Either one will work.