Interupt?
After serching through posts for a couple of hours I have decided to jump in and get my feet wet.· My son and I have purchased a HomeWork Board and have not had much trouble mastering the comands in the work book.
·Now we have built a mobile car built with stepper motor on two drive wheels and it will go where ever we write code to send it.· Next we would like to install a sensor to interupt and jump to sub-rutines.·How do you do an Interupt?· Thanks, Paul
·Now we have built a mobile car built with stepper motor on two drive wheels and it will go where ever we write code to send it.· Next we would like to install a sensor to interupt and jump to sub-rutines.·How do you do an Interupt?· Thanks, Paul
Comments
Main:
· DO
·· ·GOSUB Check_Sensors
·· ·Act_On_Sensors_If_Needed
·· ·ON task GOSUB Task0, Task1, Task2, Task3...
·· ·task = task + 1 // NumTasks
· LOOP
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
time CON 4/5
OUTH = %00000000
DIRH = %11111111
counter VAR Word
cycles VAR Byte
cycles = 0
DO
·DEBUG "Car Running!",CR
cycles = cycles +1
'······ (motor1······· motor2)
FOR counter = 1 TO 700········· 'Straight 1
OUTH = %10001000··············· 'Motor 1&2 steps
· PAUSE time
OUTH = %11001100··············· 'Motor 1&2 steps
· PAUSE time
OUTH = %01000100··············· 'Motor 1&2 steps
· PAUSE time
OUTH = %01100110··············· 'Motor 1&2 steps
· PAUSE time
OUTH = %00100010··············· 'Motor 1&2 steps
· PAUSE time
OUTH = %00110011··············· 'Motor 1&2 steps
· PAUSE time
OUTH = %00010001··············· 'Motor 1&2 steps
· PAUSE time
OUTH = %10011001··············· 'Motor 1&2 steps
· PAUSE time
NEXT