I tried to understand interrupts by creating a simple code (shown below). The idea was to have two buttons, each assigned to interrupts. The interrupt functions assigned to the buttons would run independently, and would not be interrupted by the other buttons.
I am getting two unexpected results
pressing a button once causes the serial output to count to 100 twice
pressing button One while the for loop for button Two is executing causes the the code for button One to execute, then the remainder of the code for button Two to execute
Does anyone know why I am getting these results?
Thanks
Take out those noInterrupts(); and Interrupts(); statements, they are not needed as interrupts are disabled globably automatically once inside a ISR function and get reenabled automatically when the ISR returns. That is your button two will not be able to interrupt the button1 while it's executing it's button1 ISR code, and visa versa.