Including push-button to thermometer

wvmarle:

if (digitalRead(button)) {

selectedSensor++;
  if (selectedSensor > 3) selectedSensor = 1;
}
switch selectedSensor {
  case 1:
    readSensor(sensor1pin);
    break;
  case 2:
    readSensor(sensor2pin);
    break;
  case 3:
    readSensor(sensor3pin);
    break;
}




Do debounce your button (either in hardware or software - plenty of examples out there). I assume same sensor on all pins, so you just have to provide the correct pin and read that sensor. Change the number of sensors to your number.

Yup I've learnt how to debounce :slight_smile: thanks for the example, I'll give it a go when I get my hands on the 2nd sensor!