// Project name : Black Line Follower Robot
// Designed By  : ROBOMART
//                http://www.robomart.com

/* Program for "Robot Following Black Line" 
___________________________________________________

Connection settings of Kit

Left Sensor---@------------->P1.0
Right Sensor---@------------->P1.1

RIGHT MOTOR(+)------->P0.0
RIGHT MOTOR(-)------->P0.1
LEFT MOTOR(-)-------->P0.2
LEFT MOTOR(+)-------->P0.3

RESET-------------------------->PIN9
Crystal Ossilator-------------->PIN18 and PIN19
VCC=Regulated 5V
Gnd=Ground(0V)
*/

#include<reg52.h>
sbit s1 = P1^0;	   //this pin is connected to left sensor
sbit s2 = P1^1;    //this pin is connected to right sensor
void main(void)
{
s1=0xff;      //make the bit as input pin.
s2=0xff;      //make the bit as input pin.
P0=0x00;      // make port0 as output port.
while(1)
{
if(s1==1&s2==0)
P0=0x08;		 // turn right
if(s1==1&s2==1)
P0=0x09;		 // move forward
if(s1==0&s2==1)
P0=0x01;		 //turn left
if(s1==0&s2==0)
P0=0x00;		 //	stop
 }
}