I have a data range of 0-180 that is being read via analog sensors which I send via serial to another Arduino board. I would like to reduce the traffic on the Serial connection by telling the board not to send data if it hits "0". How would I write the Arduino code to tell it to not send data if 0 is being read? I have the following so far which will also send "0" due to sending all values:
val = analogRead(fsrOne);
if (val >= 0 && val < 200) {
val = map(val, 0, 199, 0, 0);
} else if (val >= 200 && val < 800) {
val = map(val, 200, 799, 20, 120);
} else if (val >= 800 && val < 1024) {
val = map(val, 800, 1023, 120, 180);
}
Serial.write(val); // the raw analog reading