Hey I got most of the kinks worked out on this program. Its main function is to test the IRPD sensor, denpending on where the object is the board will give off a tone (because I cant work with a robot). I know it is going through all the steps however I am pretty sure that the IF commands are not correct. When nothing is there “action” should be adding up to 0 and the board should not give off a tone, however right now “action” is adding up to 3 and giving off tone that means “backup”. Im just not sure what it should look like any help would be great.
Heres the code:
'IRPD test Program
templ var bit
tempr var bit
action var nib
pause 1000 'let IRPD settle
start:
templ = 0
tempr = 0
high 12 :
pause 10
templ = in12
low 12
high 15 :
pause 10
tempr = in12
low 15
'NOTE here is where I think the problem is
action = 0
cont1:
if templ = 0 then cont2
action = action + 1
cont2:
if tempr = 1 then cont3
action = action + 2
cont3:
'action = 0, nothing in the way
'action = 1, something on front left side
'action = 2, something on front right side
'action = 3, something in front
branch action, backup, turn_l, turn_r, forward ]
backup:
sound 9, 150\3500 ]
pause 1000
goto start
turn_l:
sound 9, 150\3000 ]
pause 1000
goto start
turn_r:
sound 9, 150\2500 ]
pause 1000
goto start
forward:
pause 1000
goto start