Make a Simple Snap Circuits Programmable Robot by KRA5H

Step 3: Program the Roverbot

roverbotflowchart.jpg
Install the PICAXE Programming Editor software from the Snap Circuits Micro Software CD. Open the Programming Editor and select the 08M when prompted (for the PICAXE 08M microcontroller). Next select the COM port that the PICAXE programming cable is connected to on your computer. To create a new flowchart, click File and then click New Flowchart. Use my example flowchart to make your own flowchart.

I’ve divided up each function into columns to make the flowchart easier to read. In the first column under “start” are the commands to test the Roverbot’s left forward motor. This will cause the Roverbot to turn right. Under the label “Test left backward” are the commands to turn the Roverbot’s left motor backwards. This will cause the Roverbot to turn left. The next four columns are the commands to test the right motor turning forward and backward, then turn both left and right motors forward (Roverbot rolls forward), and finally turns both motors backwards (Roverbot rolls backwards).

You can also convert the flowchart into BASIC program code. BASIC is an acronym that stands for Beginners All-purpose Symbolic Instruction Code. It was created way back in the 1960s as an easy to understand programming language to introduce students to computer programming.

Click Flowchart and then click Convert Flowchart to BASIC. The following is what the code will look like in BASIC (I added the comments in the code to describe what the code does):

‘BASIC converted from flowchart:
‘C:\DOCUMENTS AND SETTINGS\DESKTOP\SNAPROVERBOT.CAD
‘Converted on 10/30/2011 at 20:53:11
main:
‘Snap Rover programmable robot

‘Test left forward
  pause 1000
  high 0
  pause 2000
  low 0
‘Test left backward
  pause 1000
  high 1
  pause 2000
  low 1
‘Test right forward
  pause 1000
  high 2
  pause 2000
  low 2
‘Test right backward
  pause 1000
  high 4
  pause 2000
  low 4
‘Test forward
  pause 1000
  high 0
  high 2
  pause 2000
  low 0
  low 2
‘Test backward
  pause 1000
  high 1
  high 4
  pause 2000
  low 1
  low 4
‘End program
  stop

The code is very simple but should demonstrate how easy it is to program the Roverbot.
 
Remove these adsRemove these ads by Signing Up
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!