'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' TAB Electronics Build Your Own Robot Kit BX24 Behavior 3 (Photophobe) ' by Dr. J (Juliano@csuChico.edu) ' and Matt Bauer (MBauer1@csuChico.edu) ' California State University, Chico ' Intelligent Systems Laboratory ' Chico, CA 95929-0410 ' http://isl.ecst.csuchico.edu ' October 2004 ' ' BX24 version of Myke Predko's Behavior3 (Photophobe) in PBasic. This version ' requires the BX24_byork Interface Module distributed by Chico State's ISL. ' '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Attribute VB_Name = "Photophobe" Option Explicit Public Sub Photophobe() Dim LeftCDS As Byte Dim RightCDS As Byte Dim Touched As Byte Dim Whiskers As Boolean Call SetSerialPins( SC , SD ) Call InitSerialPins() Call RobotSend( RobotStop ) ' Wait for Robot to get setup Call Sleep( Delay ) ' Flash LED thrice Call BlinkLED( 3 ) Touched = 0 ' Initialize state of whiskers Whiskers = False ' True if whiskers present Do ' indefinitely! Call ReadCurrentLightLevels( LeftCDS , RightCDS ) If( LeftCDS = RightCDS ) Then ' Go straight if equal Call GoForward( Whiskers , Touched ) ElseIf( LeftCDS < RightCDS ) Then ' Turn toward larger Call Navigate( RobotRight , RobotPWM3 ) Else Call Navigate( RobotLeft , RobotPWM3 ) End If Loop ' Until( Feelers <> 0 ) End Sub 'Photophobe() ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''