' ******************************************** ' * ((IN THE NAME OF GOD)) * ' ******************************************** ' * Title : Line Follower Robot * ' * Last Updated : 1385/6/1 * ' * Target : Atmega8L * ' * Program code : BASCOM AVR * ' * Author : Foad Alikhani * ' * WebSite : Www.Mechatronics.Co.Sr * ' * E-mail : foad_8x@yahoo.com * ' ******************************************** ' Portc 1,2,3 have been set for the sensors. ' Portb 1,2 have been set for running two motors. $regfile = "m8def.dat" $crystal = 1000000 Config Portc = Input Config Portb = Output Do If Pinc.2 = 0 Then 'if the second sensor of P3 goes low Portb.1 = 1 'then start two motors(go forward) for 500ms Portb.2 = 1 Waitms 500 End If If Pinc.1 = 0 Then 'if the first sensor of P3 goes low Portb.1 = 0 'then start one motor (turn) for 500ms Portb.2 = 1 Waitms 500 End If If Pinc.3 = 0 Then 'if the third sensor of P3 goes low Portb.1 = 1 'then start another motor (turn) for 500ms Portb.2 = 0 Waitms 500 End If Loop End