Hi All,
I am in process of designing a project as a DC voltage monitor, which turns on and off a relay depending on the voltage. Of course, I am trying to make the project as cost effective as possible.
I have hard coded upper and lower thresholds voltages scaled out of 1023. I need to be able to tweak these values and I am trying to implement these via an interrupt on a button.
The hardware consists of three buttons: CONFIG (interrupt), SET and SELECT buttons. While running the main loop, if the CONFIG button is pressed it raises an interrupt. The program jumps to the ISR.
The initial stage of the ISR to set the deviation from the lower threshold by counting the number of button presses detected on the SET button. To exit this section and proceed to the next section (setting the upper threshold), the SELECT button is pressed. The lower threshold deviation value is then stored in the internal EEPROM.
The program then expects input on the SET button in order to determine the upper threshold value. After the SET button is pressed a number of times, the SELECT button is pressed. The deviation value is then stored in the EEPROM at another address.
Upon resetting the Arduino, the system takes the hard coded values and adds them to the corresponding values in the EEPROM, then moves on to the main loop.
I'll have some LED's to indicate where I am in the procedure and I will implement hw debounce.
I need help in determining which buttons (SET and SELECT) is pressed and how many times the SET button is pressed.
I know it is long and any suggestions would be appreciated.