Update sensor.ino with if/else statement