Page 354 - Amphibionics : Build Your Own Biologically Inspired Robot
P. 354
Amphibionics 07 3/24/03 9:13 AM Page 333
Chapter 7 / Turtletron: Build Your Own Robotic Turtle
'------------------------------------------------------------------------------------------------------------------------------
' Name : encode-test.bas
encode-test.bas
program listing
' Compiler : PicBasic Pro - MicroEngineering Labs PROGRAM 7.11
' Notes : Program to test the optical interrupter
' : photodarlington switch
'------------------------------------------------------------------------------------------------------------------------------
' PortA set as outputs.
trisa = %00000000
' PortB set as outputs. pin 0 input.
trisb = %00000001
'------------------------------------------------------------------------------------------------------------------------------
' initialize variables
switch 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
low forward_right
low reverse_right
SOUND piezo,[115,10,50,10]
start:
333

