1) Start up the PICAXE Programming Editor
- Make sure that PICAXE-18x is selected (in View / Options...)
- You should see the BASIC page. (if not, Click the Basic button.. )
2) Enter the following BASIC program in Programming Editor:
3) Download the program
to the buggy:
- connect up the download lead to the socket at the back of the buggy.
- switch on the buggy,
- Click on PICAXE/Run or click the button. (or use F5)
The PIC chip is now running the program, but won't be moving.
Check that there is a Debug window on the PC screen like this:
The PicAxe chip has
They are called input0,input1,input2,input6 & input7.
Find out which microswitch you have to press to make them 1 (or ON)
Fill out the following table
by running the program above
and checking which of b0 - b7 become 1 when you press each switch:
5) REVISION: Remember what the different patterns of outputs do.
Fill out the following table by referring back to your notes from Worksheet 1:
So far you've used a simple loop that reads the inputs.
Now write a Basic program with a decision
A decision in Basic is an "if" statement.
There's a decision inside the loop so that different output commands are used depending on whether the switch is pressed or not.
Below is the structure of the program:
You have to fill in the input number (to choose which microswitch controls the
and the two output patterns (to control what the buggy does)
Look back to the revision table above, for how to control the two motors and light the LEDs.
You choose whether to
flash the lights or to move the wheels (or even both!).
Content Scl Version 23/4/07