Sunday, 26 June 2011

programming for obstacle avoider robot


//program to make a smart obstacle avoider robot using a single sensor

//Target board s/n 102011
//Manufacturer Technophilia

#include "reg51.h" // header file for 8051 series of microcontroller
#include "delay.h" //header file for generating time delay
#include "lcd.h" //header file for interfacing 16x2 charactor LCD

void main()
 {
 
  while(1)
   {
  P2=0x50; //by default robot should move forward
if(p10==1) //if sensor is detected
{
 P2=0xA0; //Move backword
 delay(500);
 P2=0x10; //tale a left turn
 delay(400);
}
   }
 }

2 comments:

  1. But its not running in c++.
    Will i have to change p2,p10 etc according to the pins of microcontroller pins? or this is the standard program?

    ReplyDelete
  2. Or tell me when i use this program which pins should be used If the microcontroller is AT89S52

    ReplyDelete