Jason Kyngdon
New Member
OK PEOPLE!
I need to know if this is going to work. The program is pretty simple and it runs when an input is accepted via the comm port.
At the moment this program is doing **** all and I need some help. And by the way, I have covered the basics so don't ask me if the comm port is connected or the jumper switch is in the right position.
Thanks
'Picaxe buggy control system to control AXE023 Motor Driver Board (08) via comm port and
'Visual Basic.
'MOTOR A IS ON THE LEFT AND MOTOR B IS ON THE RIGHT WHEN LOOKING FROM THE BACK OF THE VEHICLE
main:
'turns motors on for one second to prepare the system
high 0
low 1
high 2
low 4
wait 1
low 0
low 1
low 2
low 4
wait 1
subSerial:
'turns both motors off and waits one second before accepting
'an input from the comm. port
low 0
low 1
low 2
low 4
wait 1
serin 3, N2400, b1
write b0,b1
subCmd:
'accepting input from the comm. port and the selection of what command to execute
'depending on what input is recieved
if b1 = 70 Then label_fwd
if b1 = 66 Then label_stop
if b1 = 76 Then label_left
if b1 = 82 Then label_right
label_F9: goto subSerial
end
'runs the buggy forward for 5 seconds then stops
label_fwd: high 0
low 1
high 2
low 4
wait 5
gosub label_shutdown
goto label_F9
'stops the buggy for 5 seconds then stops
label_stop: low 0
low 1
low 2
low 4
wait 5
goto label_F9
'turns the buggy left for 5 seconds then stops
label_left: low 1
high 0
high 2
low 4
wait 5
gosub label_shutdown
goto label_F9
'turns the buggy right for 5 seconds then stops
label_right: low 0
high 1
high 2
low 4
wait 5
gosub label_shutdown
goto label_F9
'because the buggy stops after each command is executed for a specific amount of time
'no stop command is nessecary. The buggy migh run into a wall and keep going but it will
'only go for that specific amount of time.
label_shutdown: low 0
low 1
low 2
low 4
return
I need to know if this is going to work. The program is pretty simple and it runs when an input is accepted via the comm port.
At the moment this program is doing **** all and I need some help. And by the way, I have covered the basics so don't ask me if the comm port is connected or the jumper switch is in the right position.
Thanks
'Picaxe buggy control system to control AXE023 Motor Driver Board (08) via comm port and
'Visual Basic.
'MOTOR A IS ON THE LEFT AND MOTOR B IS ON THE RIGHT WHEN LOOKING FROM THE BACK OF THE VEHICLE
main:
'turns motors on for one second to prepare the system
high 0
low 1
high 2
low 4
wait 1
low 0
low 1
low 2
low 4
wait 1
subSerial:
'turns both motors off and waits one second before accepting
'an input from the comm. port
low 0
low 1
low 2
low 4
wait 1
serin 3, N2400, b1
write b0,b1
subCmd:
'accepting input from the comm. port and the selection of what command to execute
'depending on what input is recieved
if b1 = 70 Then label_fwd
if b1 = 66 Then label_stop
if b1 = 76 Then label_left
if b1 = 82 Then label_right
label_F9: goto subSerial
end
'runs the buggy forward for 5 seconds then stops
label_fwd: high 0
low 1
high 2
low 4
wait 5
gosub label_shutdown
goto label_F9
'stops the buggy for 5 seconds then stops
label_stop: low 0
low 1
low 2
low 4
wait 5
goto label_F9
'turns the buggy left for 5 seconds then stops
label_left: low 1
high 0
high 2
low 4
wait 5
gosub label_shutdown
goto label_F9
'turns the buggy right for 5 seconds then stops
label_right: low 0
high 1
high 2
low 4
wait 5
gosub label_shutdown
goto label_F9
'because the buggy stops after each command is executed for a specific amount of time
'no stop command is nessecary. The buggy migh run into a wall and keep going but it will
'only go for that specific amount of time.
label_shutdown: low 0
low 1
low 2
low 4
return