E-stop
Frank123
Posts: 4
Hello,
I have a question in reference to the Basic 1 or 2. What I need to do is if in2 =0 then it should run the scan program but if in 3 = 0 then I want the scan program to stop and then perform the dial progam. Below is the code but when input 3 is detected the scan progam continues to run.
Check:
If in 2 = 0 then scan
If in 3= 0 then Dial
goto check
Scan:
High 4
pause 100
low 4
pause 100
high 5
pause 100
low 5
goto Check
Dial:
low 4
low5
pause 10
High 6
pause 100
low 6
goto Check
I have a question in reference to the Basic 1 or 2. What I need to do is if in2 =0 then it should run the scan program but if in 3 = 0 then I want the scan program to stop and then perform the dial progam. Below is the code but when input 3 is detected the scan progam continues to run.
Check:
If in 2 = 0 then scan
If in 3= 0 then Dial
goto check
Scan:
High 4
pause 100
low 4
pause 100
high 5
pause 100
low 5
goto Check
Dial:
low 4
low5
pause 10
High 6
pause 100
low 6
goto Check
Comments
The way you've written your program, it checks for in2 first and executes Scan, then goes back and checks first for in2 again. Only if in2 is high does it even check in3. You have to release in2 first before pressing in3. If you want in2 and in3 to have a different priority, you can swap the two if statements so the test for in3 comes first. If you want some other kind of behavior, you'll have to describe more thoroughly just what behavior you want. You may need to create what's called a state machine ... in this case more than one loop where the program sits. Look up "state machine" in the Wikipedia.