' Robitics! v1.5, Initalization
' {$Stamp bs2}	
low 12
low 13	
output2
freqout 2, 2000, 3000


'beep	
output 9
output 10
out9 = in4
out10 = in6


'declarations
x var word



step1:


		'Travel Forward
		pulsout 12, 500
		pulsout 13, 1000
		pause 20


	
		'Check for the wiskers hitting
		if in6 = 0 and in4 = 0 then turn1
		if in6 = 0 and in4 = 1 then turn1
		if in6 = 1 and in4 = 0 then turn1

goto step1



turn1:

			' Travel Backward
			for x =1 to 10
			pulsout 12, 1000
			pulsout 13, 500
			pause 20
		next


			'turn right
			for x =11 to 42
			pulsout 12, 990
			pulsout 13, 990
			pause 20
		next
goto step2
	


	
step2:

		'travel forward
		pulsout 12, 500
		pulsout 13, 1000
		pause 20

		'checkwiskers for hitting
		if in6 = 0 and in4 = 0 then turn2
		if in6 = 0 and in4 = 1 then turn2
		if in6 = 1 and in4 = 0 then turn2

goto step2:

turn2:

			' Travel backward
			for x =1 to 10
			pulsout 12, 1000
			pulsout 13, 500
			pause 20
		next


			'turn left
			for x =11 to 45
			pulsout 12, 510
			pulsout 13, 510
			pause 20
		next

goto step1
Hosted by www.Geocities.ws

1