Monday, 26 April 2010

Program part 2

select case b1
case 0 to 80
high 3
case 80 to 155
low 3
endselect

select case b2
case 0 to 100
high 1
case 80 to 155
low 1
endselect

if b1>80 and b2>80 then
high 2,4
pause 3000
low 2,4
endif





If the first program works well, then generally the buggy should be able to follow the line even on a 90 degree turn (hopefully). Assuming this is true then maybe we dont really need any switching mechanism between the two programs. But for the sake of the project I will still include the switch and the interrupt in the program.

all I did was add an 'if' statement after the selectcase. this way when both LDR's are on the black tape both wheels stop. the if statement will be activated at that point and reverse the buggy backwards with a pause and then stop.

A problem I can notice immediately is that whenever both LDR's go over the black tape it will automatically reverse whether we want it or not.

No comments:

Post a Comment