I’ve been working for a while on an in-car OBD readout \ clock \ temperature gauge to replace the factory-fitted clock. I’ve got all the various inputs connected up and working well, just having a bit of trouble getting my input button to work reliably.
It’s a basic momentary push button that I want to switch between two display “pages”. The first has time, date, temperature and the second has various OBD data displays from the car’s diagnostics.
The button is wired up as per this guidance (using internal resistor on the Arduino)
Originally I had the button handling inside the “loop” code but now all my inputs are sending data that makes the button response too slow so my aim is to use interrupts instead
However the problem I’m having is that the response to input is still unreliable and at some point spews random characters onto the LCD. If I go back to the previous version of my code (before adding interrupts) the issue goes away so it looks to be down to how I’ve implemented the debounce \ interrupt.
- Physically it’s connected one side to pin D2, the other to ground.
- I was using an Arduino Uno, now move to a Nano but same results with both.
- Other hardware includes an LCD, DS18B20 temperature sensor and DS3234 RTC module.
if I watch the serial monitor I can see the counter increasing but not always in time with me pressing the button. Code is in my next post below, put together from various snippets I’ve found so probably won’t win any awards for efficiency.