-pseudo code-

-intro- -aims- -initial design- -progress- -development- -problems & solutions- -contract- -group members- -links & references- -forum- -meeting minutes- -pseudo code-

 

LAST UPDATED: 03-Feb-2003

Start Main Program

      int a,b,x,y

      For (infinite loop)

              x=detect white line function left

              y=detect white line function right

              a=detect black function left

              b=detect black function right

             Send to  Decision function(x,y,a,b)

        End For loop

End Main Program

 

 

Start decision function(x,y,a,b)

       

           if(x and y and a and b=0)

                            Call to move both stepper motor

                            Call to stop stepper motor

 

                    else if(x=1 and y=0 and a=0 and b=0)

                            Call to move stepper motor left

                            Call to stop stepper motor

                   

                    else if(x=1 and y=0 and a=0 and b=1)

                            Call to move stepper motor left

                            Call to stop stepper motor

 

                    else if(x=0 and y=1 and a=0 and b=0)

                             Call to move stepper motor right

                             Call to stop stepper motor

                    

                     else if(x=0 and y=1 and a=1 and b=0)

                             Call to move stepper motor right

                             Call to stop stepper motor

 

                    else

                              Call stop stepper motor

 

End function

 

int Detect white line function left

        return x=0 if white line is found

        return x=1 if white line is not found

End Function

 

int Detect black function left

        return a=0 if black is found

        return a=1 if black is not found

End Function

 

int Detect white line function right

        return y=0 if white line is found

        return y=1 if white line is not found

End Function

 

int Detect black function left

        return b=0 if black is found

        return b=1 if black is not found

End Function

 

 

Move right stepper motor function

        Move stepper motor based on program from module 2a1

End Function

 

 

Move left stepper motor function

        Move stepper motor based on program from module 2a1

End Function

 

 

Stop Stepper motor function

        Stop stepper motor by changing the tables to hex 0x00

End Function