Junhao's ICT Website
  • Home
  • Clawbot
  • Easy Program Robot
  • Line Tracking Robot
  • About

Line Tracking Robot

The line tracking robot
Recorded by Nokia Lumia 635

HOW IT WORKS

Your browser does not support viewing this document. Click here to download the document.
The blue squares are the 3 line trackers.

As you can see, the black line is under the 3 trackers.

②When tracker[a] detects the black line, the robot turns left.

③When tracker[b] detects the black line, the robot turns right.

Those codes were programmed on EasyC V5 for Cortex with version 4.23 configuration.

Main
#include "Main.h"
void main ( void )
{
      int line = 200;
      int a;
      int c;
      while ( 1==1 )
      {
            a = GetAnalogInput ( 1 ) ; 
            c = GetAnalogInput ( 3 ) ;
            if ( a>line )
            {
                  SetMotor ( 10 , -95 ) ;
                  SetMotor ( 10 , 0 ) ;
            }
            if ( c>line )
            {
                  SetMotor ( 1 , 127 ) ;
                  SetMotor ( 1 , 0 ) ;
            }
             else
            {
                  SetMotor ( 1 , 80 ) ;
                  SetMotor ( 10 , -65 ) ;
                  SetMotor ( 1 , 0 ) ;
                  SetMotor ( 10 , 0 ) ;
            }
      }
}

Continue
Powered by Create your own unique website with customizable templates.