Simple Line Follower Robot
- Aravind
- Feb 22, 2015
- 1 min read
Things u need is...

An Arduino
A motor shield
2 IR sensors
4 motors (in my case)
A 4 wheeler chassis
Battery as usual for arduino and motor shield
My Line Follower at IIT Delhi

Here I have a 3D model of all components that we will be using:
An Arduino

The motor shield (any motor shield that has an LD293 IC on it)

The IR sensor

Motor (A servo motor in this case)

Chassis (Aluminum chassis with holdings)

This Below picture is a rough diagram of how I fit all the controllers in the chassis

Code for the working of this Bot
(Here I use Arduino IDE for easy installing and use purpose)
void setup () {
pinMode(2,INPUT);
pinMode(3,INPUT);
pinMode(4,OUTPUT);
pinMode(5,OUTPUT);
pinMode(6,OUTPUT);
pinMode(7,OUTPUT);
}
void loop () {
if(digitalRead(2)==HIGH&&digitalRead(3)==HIGH){
digitalWrite(4,HIGH);
digitalRead(5,LOW);
digitalRead(6,HIGH);
digitalRead(7,LOW);
}
if(digitalRead(2)==LOW&&digitalRead(3)==HIGH){
digitalWrite(4,LOW);
digitalRead(5,LOW);
digitalRead(6,HIGH);
digitalRead(7,LOW);
}
if(digitalRead(2)==HIGH&&digitalRead(3)==LOW{
digitalWrite(4,HIGH);
digitalRead(5,LOW);
digitalRead(6,LOW);
digitalRead(7,LOW);
}
This is activated as reverse motion
[endif]--![endif]--[endif]--![endif]--if(digitalRead(2)==LOW &&digitalRead(3)==LOW){[endif]--
digitalWrite(4,LOW); //or digitalWrite(4,LOW);
digitalRead(5,LOW); //or digitalRead(5,HIGH);
digitalRead(6,LOW); //or digitalRead(6,LOW);
digitalRead(7,LOW); //or digitalRead(7,HIGH);
}
}
![endif]--
留言