4.3 Downloading the program to drive your bump robot
Once your bump robot is built:
1. Start the
Programming Editor
or
AXEpad
and open the file
BumpRobot.bas
from your
CD-ROM ( File/Open).
2. Save the program (File/Save As…) to a location on you hard drive.
3.
Connect the download cable to your motherboard.
4. Press the F5 key to download your program into the PICAXE on your Versabot
motherboard.
5.
Disconnect the download cable and place your Versabot on the ground.
6.
Press the button on the Button Module to start your Bump Robot.
4.4 The Code
We have included the code here so that you can investigate the program used:
'**Variables**
symbol
temp
= w0
'**PICAXE motherboard output pin definitions**
symbol
P0
= B.0
symbol
P1
= B.1
symbol
P11
= C.3
symbol
P12
= C.4
'**PICAXE motherboard input pin definitions**
symbol
IN6
= pinB.6
Symbol
IN13
= pinC.5
symbol
IN15
= pinC.7
'**Outputs**
symbol
LeftLED
= P0
symbol
RightLED
= P12
symbol
RightMotor
= P11
symbol
LeftMotor
= P1
'**Inputs**
symbol
PushButton
= IN6
symbol
LeftBumper
= IN15
symbol
RightBumper = IN13
'Initialise Motor outputs
StartOfProgram:
high
RightMotor
high
LeftMotor
pause
50
StopRobot:
gosub
StopMotors
' Call StopMotors
low
LeftLED
' Turn LeftLED off
low
RightLED
' Turn RightLED off
pause
250
' Pause for 250ms
do
' Ensure no button pushed
loop until
PushButton = 0
do
' Wait until button pushed
loop until
PushButton = 1
Содержание Versabot
Страница 1: ...The Versabot Manual July 2009...
Страница 23: ...Step 03 Step 04 Step 05...
Страница 24: ...Step 06 Step 07 Step 08...
Страница 25: ...Step 09 Step 10 Step 11...
Страница 26: ...Step 12 Step 13...