Sunday, August 25, 2013

Simple Line Follower

Coding :
#include<reg51.h>
sbit motor_11 = P2^0;
sbit motor_12 = P2^1;
sbit motor_21 = P2^2;
sbit motor_22 = P2^3;
sbit sensor_3 = P1^2;
sbit sensor_4 = P1^3;
sbit sensor_5 = P1^4;
void main()
{
P2=0×00;
P1=0×00;
P1=P1|0x1c;
while(1)
{
if(sensor_3==1 && sensor_4==1 && sensor_5==1)
{
motor_11=1;
motor_12=0;
motor_21=1;
motor_22=0;
}
else if(sensor_3==0 && sensor_4==1 && sensor_5==1)
{
motor_11=1;
motor_12=0;
motor_21=1;
motor_22=1;
}
else if(sensor_3==1 && sensor_4==1 && sensor_5==0)
{
motor_11=1;
motor_12=1;
motor_21=1;
motor_22=0;
}
else
{
motor_11=0;
motor_12=1;
motor_21=0;
motor_22=1;
}
}
}
Proteus Simulation Circuit :



No comments :

Post a Comment

feel free and ask...

IP Address Checker