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

/* Program for "Robot Following Wall" 
___________________________________________________

Connection settings of Kit

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

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 sensor = P1^0;	  //this pin is connected to left sensor
void main(void)
{
sensor=1;             //make the bit as input pin.
P0=0x00;              // make port2 as output port.
while(1)    
{
if(sensor==1)
{
P0=0x08;			  // turn right
}
else
{
P0=0x01;			  // turn left
}
 }
}