int val = Serial.read()-('0'); if (val ==1 ) {
Or, you can do this: int val = Serial.read();
if (val == '1' ) {