Good day Everybody!!!
Its a beautiful day, isn't?
What I'm actually trying to achieve is to control 2 loops by using a single pushbutton!
It should work as follows:
- 1st press, loop1 start running
- 2nd press, loop2 start running
- 3rd press, loop1 can re-start running
..........................
and so on...
Here's the algo I came up with:
Checkpress
if pressed goto loop1
if not pressed goto checkpress
Loop1
;loop1body
.......................
if pin=0 (which is a press) goto loop2
if pin=1 (which is not press) goto loop1
Loop2
;loop2body
........................
if pin=0 goto loop1
if pin=1 goto loop2
In the above algorithm, pin is the same pin in the checkpress loop...
Does it make sense? Please I need ur comment or if u have a more elegant way of achieving this please show me
Also, when power is put off and then put back on, where does the program start? Where it stopped or at the beginning of main? (Excuse me if this is a stupid question).
Eric007
Its a beautiful day, isn't?
What I'm actually trying to achieve is to control 2 loops by using a single pushbutton!
It should work as follows:
- 1st press, loop1 start running
- 2nd press, loop2 start running
- 3rd press, loop1 can re-start running
..........................
and so on...
Here's the algo I came up with:
Checkpress
if pressed goto loop1
if not pressed goto checkpress
Loop1
;loop1body
.......................
if pin=0 (which is a press) goto loop2
if pin=1 (which is not press) goto loop1
Loop2
;loop2body
........................
if pin=0 goto loop1
if pin=1 goto loop2
In the above algorithm, pin is the same pin in the checkpress loop...
Does it make sense? Please I need ur comment or if u have a more elegant way of achieving this please show me
Also, when power is put off and then put back on, where does the program start? Where it stopped or at the beginning of main? (Excuse me if this is a stupid question).
Eric007