while(1) { if (need_debounce) { // ignore anything on pushbuttons for about 200 ms DoButtonDebounce(); need_debounce = 0; } if (docounter) ReadCounter(); if (dotemperature) readTemperature(); if (dohumidity) readHumidity(); enter_stop_mode(); }