This is going to be difficult to explain, and I must say wierd.
I have writen a very large programme which is behaving strangely. To be as quick as possible, it is a game where there are several butons that are pressed in a sequence.
If the sequence is wrong then the game starts again.
Trouble is that after they have got it wrong, if they press buttons before the game starts, the arduino seems to remember them. Like I said wierd.
From what I understand, the only time inputs are read, is when there is a digital readevent. All read events are not running, then when turned back on all the events (upto 3) are recorded, which were pressed when the readevents were not turned on.
Here is a snippet from my programme to try to illustrate this:
In the loop event i have:
if (dontrun == 0)
checkbuttonpress(); //sets out variables “in” to 0 or 1 depending on button press
in one of my subroutines (which deos go trough the loop event I have:
if (done_in_time == 0)
dontrun = 1;
beat = 3;
beat_tot = 0;
dontrun = 0;
the variables are not important, but you can see that dontrun is set to 1 at the start and returned to 1 at the end. Yet if I press buttons while the delays etc are running, the button presses are remembered after the subroute has finished.
Hope that makes some sence, it is very strange.