'------------------------------------------------------ ' Name : encode-test.bas ' Compiler : PicBasic Pro - MicroEngineering Labs ' 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: If switch = 0 then SOUND piezo,[80,5,110,5,50,10,120,2] while switch = 0 wend endif goto start