Page 267 - Amphibionics : Build Your Own Biologically Inspired Robot
P. 267

Amphibionics 06  3/24/03  9:02 AM  Page 246
                                                       Amphibionics
                      PROGRAM 6.5
                                          '  Name     : walk-routines.bas
                      walk-routines.bas
                                          '  Compiler : PicBasic Pro - MicroEngineering Labs
                      program listing     '------------------------------------------------------------------------------------------------------------------------------
                                          '  Notes     : various walking subroutines
                                          '------------------------------------------------------------------------------------------------------------------------------
                                          ' PortA set as outputs. pins 0 and 1 inputs
                                          trisa = %00000011
                                          ' PortB set as outputs. pin 1 input.
                                          trisb = %00000001

                                          '------------------------------------------------------------------------------------------------------------------------------
                                          ' initialize variables

                                          include "modedefs.bas"

                                          enable_right     VAR PORTB.1
                                          forward_right    VAR PORTB.2
                                          reverse_right    VAR PORTB.3
                                          enable_left       VAR PORTB.4
                                          reverse_left      VAR PORTB.5
                                          forward_left      VAR PORTB.6
                                          limit_left            VAR PORTA.0
                                          limit_right          VAR PORTA.1
                                          piezo                 VAR PORTA.3
                                          temp                  VAR BYTE

                                          low enable_left
                                          low forward_left
                                          low reverse_left

                                          low enable_right
                                          low forward_right
                                          low reverse_right

                                          SOUND PIEZO,[115,10,50,10]

                                          start:



                      246
   262   263   264   265   266   267   268   269   270   271   272