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

Amphibionics 07  3/24/03  9:13 AM  Page 301
                                        Chapter 7 / Turtletron: Build Your Own Robotic Turtle
                        transmitting forward and turn-right commands to the robot. The
                        robot will respond by moving in a forward-right arc.
                        '------------------------------------------------------------------------------------------------------------------------------
                                                                                   PROGRAM 7.1
                        '  Name     : turtle-receive.bas
                                                                                   turtle-receive.bas listing
                        '  Compiler : PicBasic Pro - MicroEngineering Labs
                        '  Notes     : Robot remote control using the Linx 433LC
                        '               : series transmitter and receiver.
                        '------------------------------------------------------------------------------------------------------------------------------
                        ' PortA set as outputs.
                        trisa = %00000000

                        ' PortB set as outputs. pin 0 input.
                        trisb = %00000001

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

                        include "modedefs.bas"

                        rx_baud            CON N2400
                        rxmit                 VAR PORTB.0
                        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
                        piezo                VAR PORTA.3
                        control              VAR BYTE
                        temp                 VAR BYTE

                        low enable_left
                        low forward_left
                        low reverse_left

                        low enable_right


                                                                                                 301
   317   318   319   320   321   322   323   324   325   326   327