Home    Worksheets    Subroutines   

Help sheet 104a:
Running in a curve

This sheet tells you how to adjust the speeds of the motors to steer a smooth curve.


1) Look at the BASIC program below:
It waits for the right hand switch to be pressed (swonoff), and then runs a loop forever.

In the loop it moves forward for 1 second, then spins right a bit.

 
' --- Curved line program ------
main: gosub swonoff      
   
'-------------------------- ' 
      do                    '
      let pins=%01010000    ' forwards 
      pause 1000            ' wait 1 second
      let pins=%10010000    ' spin right
      pause 100             ' wait 0.1 second
      let pins=0            ' stop
      loop                  ' loop
'----------------------------
 
  Flowchart

This program goes forward,
steering to the right once a second.

2) Copy the program  using the "copy" button above, and paste to Programmer's Editor


Also, get a copy of subroutine swonoff from the subroutines page.

3) Download the program to the buggy:

Press the microswitch and release it to see the action.

4) Evaluation:

Did it go in a smooth curve?        

Was the curve too straight? or too sharp a curve?     

5) Adjustment: Here's how to adjust the program.
If you want to make it less jerky click here to see how:

If you want to make it curve more click here to see how:
If you want to make it curve less click here to see how:

Keep adjusting your program and downloading it to the buggy,
    till you get it to follow the curved path you need.

5) Using the results.
You can use the spin and pause values in a copy of subroutine "fwd",
 when you want to follow a curve instead of a straight line.


Record the pause values you used in your Buggy Journal.
 


Content Scl Version 20/04/07