AI for Phase 1
Home Up Pictures of Phase 1 Phase 1's Guts AI for Phase 1



View Matthew Whited's profile on LinkedIn


 


Basic Stamp 2 (phase1_ai.bs2) alpha-release

'AI for Phase 1 
'Writen by Matthew Whited
'Alpha release - v0.1 - 12/29/2001

'irpd		left 	pin0
'irpd		right 	pin1
'irpd		signal	pin2

'h-bridge	b1	pin3	left motor
'h-bridge	b2	pin4	left motor
'h-bridge	a1	pin5	right motor
'h-bridge	a2	pin6	right motor

'LED			pin7

templ var bit
tempr var bit
action var nib

pause 1000

start:
	pause 750

	'test right
	high 1: pause 5
	low 1: pause 5
	high 1: pause 5
	tempr = in2
	low 1

	'test left
	high 0: pause 5
	low 0: pause 5
	high 0:pause 5
	templ = in2
	low 0

	action = 0
		if templ=1 then cont1
		action=action+1
cont1:
		if tempr=1 then cont2
		action=action+2
cont2:

	branch action, [ forward, turn_r, turn_l, backup ]

goto start

forward:
	low 3
	low 6
	high 5
	high 4
	low 7
goto start

turn_r:
	low 3
	low 5
	high 4
	high 6
	low 7
goto start

turn_l:
	low 4
	low 6
	high 3
	high 5
	low 7
goto start

backup:
	low 4
	low 5
	high 3
	high 6
	high 7
goto start


 

Home Up Pictures of Phase 1 Phase 1's Guts AI for Phase 1
Copyright Matthew W. Whited 2006-2008
07/02/2008 07:32 PM

Λ Ω Π Σ

Custom Search