School Baseboard Simulation

1) Learning
- learn how to program the buggy go in a straight line 

2) Task:
Make the buggy go from bay 2 to bay 1 in a straight line.

3) Buggy Simulator

Choose your buggy and press Go to start the simulator:    (each steers slightly differently)

Then use Alt/Tab to switch between this page and the simulator

4) First steps (before you enter any program):

You  need  to have the Run control switched ON in order  for the buggy to move:  

4.1) Power switch To begin with, turn the power on, and then try switching on Output 4,5,6 or 7:

Turn it off again to stop the movement.  Try combinations of pins to check the movement.

4.2) The Pen

Turn on the pen, and you can see whether it's going in a straight line.

Note: It's often helpful to see what's going on, to turn on the pen:  

4.3) Reset  The link in the top right hand cornet (Reset) clears the screen and stops the buggy.
(It doesn't clear the program if there's one loaded)

5) Subroutine fwd
This subroutine makes the buggy go forward for 1/10th of a second.

It can be modified  to make one of the motors stop early,
and thus  go at less than full speed.  This adjusts the steering

'--This subroutine must be after the main program
        let pins=%01010000  'both motors forwards
        pause 100            'let them run
' * * * adjust these next three lines * * * 
'       low 4               ' stop left motor
'       low 6               ' stop right motor
'       pause 0             ' uncomment this 
        let pins=0          'stop both motors
        return              'return to main program


"Download" this subroutine into the Simulator as follows:
5.1) Copy the subroutine to the clipboard using the button above.
5.2) Switch to the simulator window using Alt/Tab.
5.3) Press the "Edit" button on the simulator so it goes into mode and you can edit its program.
5.4) Click on the program window and type Ctrl/V to paste the subroutine.

Now enter the following Main Program above the subroutine.
This calls the fwd subroutine forever.

'--This main program must be before the subroutine
     gosub fwd   ' go forward 100 ms
     goto main   ' loop forever


 You now have a program in the simulator. -Try it out by pressing "Run" button on the simulator.
If you switch the pen on you cans see more easily whether it's going in a straight line.


content jfi 12/4/2008