I’m working on a device that runs from a cell battery and has a buzzer and 1 button. The processor I use is Attiny85V. The schematic is very simple: Port 1 is connected to the buzzer and port 2 connected to a switch (switch to ground). All inputs (also unused) are internally pulled-up. When battery is connected the device starts in ‘On’ state, which means it will buzz randomly every ±10 minutes. When pressing the button shortly, it will switch off. Press-and-hold the button will switch to a higher level (1,2 or 3), which means the buzzing intervals will go up (from ±10 to 15 or 20 minutes).
When not buzzing, the device is in sleep mode, and wakes-up by a Watchdog timer. When pressing the button in sleepmode, the INT0 (same pin as port 2) gets the device out of sleep.
My problem: Sometimes the device seems to ‘hang’. It is not doing anything, doesn’t react on button press. It will only go back to normal after I disconnect battery.
Anyone there to help looking for the problem?
Is it maybe the part in setup where I switch-off the ADC to save power? Or do I make a mistake with the Interrupt? I’m not really good in programming, so forgive me for stupid mistakes I have made… :
Many thanks - Steven
main_code_revE_debug.ino.ino (6.8 KB)