So I’ve got code that does a lot of things already and probably shouldn’t be slowed down by any large chunks, anyway. And while I can program, I’d say when it comes to true embedded development, I’m a bit of a neophyte.
My device has a couple buttons connected direct to digital inputs. It also has a small i2c LCD display, an i2c temp/hum sensor, and a PWM fan connected to a digital pin. There’s a PID running the fan based on the temp sensor and I also plan to add an O2 sensor via an i2c 12 bit ADC. Buttons are interfaced with clickButton.
The buttons are used to adjust the temp, but I’d like to add code to have a button press turn on the LCD backlight and then have the backlight time out and turn off something like 10 seconds after the last button press. Anyone got any pointers to the smartest way to make that happen in this kind of situation? I’m pretty good at deciphering sample code for the bits I want, less good at doing things from scratch (but I can usually muddle through). I mean I assume I can just check the time after the button press and then keep checking it every time through loop until 10s has passed (I mean I know how to do math), but is that a reasonable way to do it, or is there a better way?