I have a program running with the watchdog timer. I read somewhere that there was a problem with the watchdog on the mega although I believe it was an older bootloader??
anyway,
I have two buttons (connected to 10k pull down resistors) and the software reads both states then make some decisions based on either button pressed or both buttons pressed.
In the event of both buttons pressed, the mega restarts.
Individual button presses work as expected.
The watchdog timer is 8s and I dont believe it to be running this long before restarting so Im not sure if the watchdog is even the issue.
heres the particular code
HeatButtonState = digitalRead(HeatButton);
HWSButtonState = digitalRead(HWSButton);
//HeatOverideState = digitalRead(HEATOveride);
//HWSOverideState = digitalRead(HWSOveride);
if (HeatButtonState == true) {
HEATBoost = true;
blinkLED();
if (RTCHour == 23) {
HEATBoostHour = 0;
} else {
HEATBoostHour = (RTCHour + 1);
}
HEATBoostMinute = RTCMinute;
}
if (HWSButtonState == true) {
HWSBoost = true;
blinkLED();
if (RTCHour == 23) {
HWSBoostHour = 0;
} else {
HWSBoostHour = (RTCHour + 1);
}
HWSBoostMinute = RTCMinute;
}
if (HeatButtonState == true && HWSButtonState == true) { //resetting when this occurs!!!!
blinkLED();
HEATBoost = false;
HWSBoost = false;
Serial.println("Boost mode cancelled!!!!!");
}
I dont know what bootloader I have installed or if I need to update it or if that is even an issue. I thought maybe both buttons were causing some power issue but it only occurs when the software gets to that part of the code, not when the buttons are pressed.