For those who seems doing the tutorial correctly but the robot keep moving straight, do this step: ADJUST YOUR IR SENSOR POTENTIOMETER TO LOW, keep it adjusted between reading surface and stop when crossing black line, @diy builder didn't explain it, but this is very important step
Step 2: Hardware Installation Hardware Installation Hardware Installation 1. Assemble the 2WD Smart Car Chasis 2 Wheels 2. Connect the IR sensor to Analog to Digital and Comparator Module IN1 > IR Sensor 1 IN2 > IR Sensor 2 IN3 > IR Sensor 3 IN4 > IR Sensor 4 3. Then, connect the output pin to Arduino UNO analog pin OUT1 > A2 OUT2 > A3 OUT3 > A4 OUT4 > A5 4. Connect Vin to 5V and GND to GND in Arduino UNO 5. Then, connect the motor driver pin to Arduino UNO pin IN1 > D10 IN2 > D9 IN3 > D6 IN4 > D5 6. Connect the both motor to motor driver Motor A > Right motor Motor B > Left motor After completing the connection, connect the Arduino to power supply with USB cable.
Good video and also good coding. Thank you very much for your wonderful work. Still i have a question. Do i also need to supply the arduino with a 5v battery or only the motor driver? The dc motors run faster if i supply the arduino with a seperate supply but i do not know if this is safe or does it damage the arduino module.
Dank u wel meneer for info. I'm studying HBO university. They asked on the first course to build a car that follows the line and avoids obticles i dont know what to build. At least here you showed from what to start. Thanks
Hello! Thank you for making this fantastic video but I somehow cannot open the code. Can you please re-send it? That would be really helpful, thank you!
I got a already built chasis and i can see small 4 wheels ahead of the motors connected there beneath the chasis. Would it make any difference ?? If i follow your steps what changes i need to make ?
// NOTE Before writing this code Go to - tools - manage library - Search: Motor Driver - Install the adafruit motor shield library// //Including the libraries #include //defining pins and variables #define lefts A4 #define rights A5 //defining motors AF_DCMotor motor1(1, MOTOR12_1KHZ); AF_DCMotor motor2(2, MOTOR12_1KHZ); AF_DCMotor motor3(3, MOTOR34_1KHZ); AF_DCMotor motor4(4, MOTOR34_1KHZ); void setup(){ // Setting the speed of the motor motor1.setSpeed(120); motor2.setSpeed(120); motor3.setSpeed(120); motor4.setSpeed(120); //declaring pin types pinMode(lefts,INPUT); pinMode(rights,INPUT); //begin serial communication Serial.begin(9600); } void loop(){ //printing values of the sensors to the serial monitor Serial.println(analogRead(lefts)); Serial.println(analogRead(rights)); // Line detected by both if(analogRead(lefts)
@@madhavanj5489 nope , i had to do major mofifications, firsly the motor speed is set too low on the code that the motors wouldnt move , once i increased the speed the robot moves too fast and ignores the line , therefore i bought new geared dc motors with 15rpm today im going to test if they will work
In the video, he has forgot to remove the jumper, while connecting external power supply to the shield. But how on earth did it work?? I think your shield will work now.
Hello sir, your video is very informative but I unfortunately cannot access the circuit diagram and code. It will be very kind of you to help me regarding this issue.
Bro I have a problem the line following robot is responding to every object instead of black only i tried to change the potentiometer reading by rotating the cube but nothing happens
Try to change the intensity of ir sensor 😁 and brother never use ready made ir sensor coz there vulnerable to light... Better try to make your own one.. And it's really a easy task to make one...
Hello! Thank you for making this fascinating project! I want to make a project similar to this, but the motor drivers on Amazon do not have pin headers where you plugged in the IR sensors at timestamp 3:03. Did you solder pin headers into your board on the lower right side?
@josh I'm trying to build one would you help me in ? plz drop your email then. I really want to learn but I'm a beginner and nothing is looking understandable to me. Im confused :(((
The Arduino code that you given below is not gong to work the values of the IR sensor is wrong & THEIR WAS A LOT MORE MISTAKES one of them was the read command but non of them will show up as errors which feels like this is intentional & the code given the description is different from the one he is using
For this tutorial, we requires these items: 1. Arduino UNO 2. 2WD Smart Car Chasis 2 Wheels 3. Arduino Mini DC Motor Driver Dual H-Bridge PW Control (L293D) 4. IR Line Tracking Sensor (4 bits) 5. Battery 6. Double side tape 7. Wires 8. Jumper wire 9. Black tape Add TipAsk QuestionCommentDownload Step 2: Hardware Installation Hardware Installation Hardware Installation 1. Assemble the 2WD Smart Car Chasis 2 Wheels
Step 2: Hardware Installation Hardware Installation Hardware Installation 1. Assemble the 2WD Smart Car Chasis 2 Wheels 2. Connect the IR sensor to Analog to Digital and Comparator Module IN1 > IR Sensor 1 IN2 > IR Sensor 2 IN3 > IR Sensor 3 IN4 > IR Sensor 4 3. Then, connect the output pin to Arduino UNO analog pin OUT1 > A2 OUT2 > A3 OUT3 > A4 OUT4 > A5 4. Connect Vin to 5V and GND to GND in Arduino UNO 5. Then, connect the motor driver pin to Arduino UNO pin IN1 > D10 IN2 > D9 IN3 > D6 IN4 > D5 6. Connect the both motor to motor driver Motor A > Right motor Motor B > Left motorStep 2: Hardware Installation Hardware Installation Hardware Installation 1. Assemble the 2WD Smart Car Chasis 2 Wheels 2. Connect the IR sensor to Analog to Digital and Comparator Module IN1 > IR Sensor 1 IN2 > IR Sensor 2 IN3 > IR Sensor 3 IN4 > IR Sensor 4 3. Then, connect the output pin to Arduino UNO analog pin OUT1 > A2 OUT2 > A3 OUT3 > A4 OUT4 > A5 4. Connect Vin to 5V and GND to GND in Arduino UNO 5. Then, connect the motor driver pin to Arduino UNO pin IN1 > D10 IN2 > D9 IN3 > D6 IN4 > D5 6. Connect the both motor to motor driver Motor A > Right motor Motor B > Left motor
Would you please provide the code for this build that doesn't have to follow the black line ? I'm building one to go on a pre-build track that's 5ft wide and 10ft long rectangle . The track has 1 ft wide and about 2 ft rectangular round-abound in the middle
Hello, your video is so clear and well edited and I have made this project. The problem I have is the robot is just moving forward and not following the line, can you suggest me some areas I may have done a mistake so I can correct it and make it work😃
iT'S TRUE. YOU CAN USE THIS. I USED 2 MOTORS. OF COURSE, I AM A NOOB AND THIS IS JUST A SMAR COPY PASTE REPLACE EDIT. dOWNLOAD THE ADAFUIT GITHUB FIRST. #include //MOTOR DEFINATION AF_DCMotor motor1(1); AF_DCMotor motor4(4); //Sensor Connection const int left_sensor_pin =A0; const int right_sensor_pin =A1; int left_sensor_state; int right_sensor_state; void setup() { left_sensor_state = analogRead(left_sensor_pin); right_sensor_state = analogRead(right_sensor_pin); motor1.setSpeed(180); motor4.setSpeed(180); motor1.run(RELEASE); motor4.run(RELEASE);
@@testname367 Where are motors 2 and 3? u r basically using just 2 motors for a 4 wheeled vehicle. U r not specifying what colour IR Sensors are supposed to be following. There are a million other mistakes. This code is wrong on so many levels!!! No offence but I don't really think it will work.
@DIY Builder Are this robot follow all kind of trackes or only that one's which shown in video. Are your code for this is able to follow other trackes or only this one's???
For those who seems doing the tutorial correctly but the robot keep moving straight, do this step: ADJUST YOUR IR SENSOR POTENTIOMETER TO LOW, keep it adjusted between reading surface and stop when crossing black line, @diy builder didn't explain it, but this is very important step
How that car will run
By keeping that battery will it run automatically
can you explain it clear please i have the same problem
@@rockstarrumbles5307 did you figure it out ??
my car won't run from the battery is there anything i can do to rectify it
Step 2: Hardware Installation
Hardware Installation
Hardware Installation
1. Assemble the 2WD Smart Car Chasis 2 Wheels
2. Connect the IR sensor to Analog to Digital and Comparator Module
IN1 > IR Sensor 1
IN2 > IR Sensor 2
IN3 > IR Sensor 3
IN4 > IR Sensor 4
3. Then, connect the output pin to Arduino UNO analog pin
OUT1 > A2
OUT2 > A3
OUT3 > A4
OUT4 > A5
4. Connect Vin to 5V and GND to GND in Arduino UNO
5. Then, connect the motor driver pin to Arduino UNO pin
IN1 > D10
IN2 > D9
IN3 > D6
IN4 > D5
6. Connect the both motor to motor driver
Motor A > Right motor
Motor B > Left motor
After completing the connection, connect the Arduino to power supply with USB cable.
My ir sensor lights stay green and the car is not moving… I need help it’s for a school project 😢
Bro there is a screw just rotate it a bit it will work.. By rotating the screw you can adjust the range of the IR sensor 🤞🏼
@@anindyaghosh1762
Then also not wodking
finally one with uno and motor shield.
Thanks a lot bro, you are a lifesaver
Same
I am also making as first and I want to use a motor shield
Good video and also good coding. Thank you very much for your wonderful work. Still i have a question. Do i also need to supply the arduino with a 5v battery or only the motor driver? The dc motors run faster if i supply the arduino with a seperate supply but i do not know if this is safe or does it damage the arduino module.
Dank u wel meneer for info. I'm studying HBO university. They asked on the first course to build a car that follows the line and avoids obticles i dont know what to build. At least here you showed from what to start. Thanks
you're welcome
@@DIYBuilder please send code we are done with this and need code
Which course
is there a difference between the arduino uno ATmega328P? or I should purchase the exact model posted in the description box?
No, you can use either
You should upload the code too here only. As without code your video is of no use.
I strongly agree with you
Yeah, me too.
Code is there in description
Well said bro
Yes
Thank you. keep uploading this kind of videos. Very useful and easy to make.
Don't forget to upload the .ino file
drive.google.com/file/d/1lddLLnkmZmYjjvB-nVPX45FV_P5i783T/view
😅
it is very good but i have some problem with the jump wire because i'll have to buy female to female jumpwire
Great job! Congrats! Thanks for sharing.
the build is working need some minor tweaking of the code but it works thank you.
Hi,
Can You advice me where can I find robotic exercises?
As again great video bro your all videos are 👌👌👌👌👌👌👌👌🔥🔥🔥🔥🔥🔥💯💯💯💯
Hello! Thank you for making this fantastic video but I somehow cannot open the code. Can you please re-send it? That would be really helpful, thank you!
It will not be opend in mobile, it will open in laptop having Aurduino ide
Sir please create video of all in one i.e Bluetooth control ,line follow and obstacle avoidance..your work is clean clear and great
Now this seems real easy to me.thanks man
well, did you get your answer
if you did can you please tell me because I do not know
@@justsomepotato1554 What do you want exactly to know?
@@alexyouou7560 i finished my project and I completely forgot what I wanted to know
Thanks for responding though
@@justsomepotato1554what problems did you faced
I got a already built chasis and i can see small 4 wheels ahead of the motors connected there beneath the chasis. Would it make any difference ?? If i follow your steps what changes i need to make ?
You are very honest man
and you did aperfect work
Thanks
hey! Thank you very much for this project and Can Upls tell that the battery u used is of how many MAH
// NOTE Before writing this code Go to - tools - manage library - Search: Motor Driver - Install the adafruit motor shield library//
//Including the libraries
#include
//defining pins and variables
#define lefts A4
#define rights A5
//defining motors
AF_DCMotor motor1(1, MOTOR12_1KHZ);
AF_DCMotor motor2(2, MOTOR12_1KHZ);
AF_DCMotor motor3(3, MOTOR34_1KHZ);
AF_DCMotor motor4(4, MOTOR34_1KHZ);
void setup(){
// Setting the speed of the motor
motor1.setSpeed(120);
motor2.setSpeed(120);
motor3.setSpeed(120);
motor4.setSpeed(120);
//declaring pin types
pinMode(lefts,INPUT);
pinMode(rights,INPUT);
//begin serial communication
Serial.begin(9600);
}
void loop(){
//printing values of the sensors to the serial monitor
Serial.println(analogRead(lefts));
Serial.println(analogRead(rights));
// Line detected by both
if(analogRead(lefts)
did the line follower works perfectly for you
@@madhavanj5489 nope , i had to do major mofifications, firsly the motor speed is set too low on the code that the motors wouldnt move , once i increased the speed the robot moves too fast and ignores the line , therefore i bought new geared dc motors with 15rpm today im going to test if they will work
If it work, pls notify me, buying this components is ok na?
Nope i dont recommend it too much trouble
Great video. It is a great project for my school exhibition!
hey bro can you make a video on how to fix the l293d motor shield because mine is not responding
In the video, he has forgot to remove the jumper, while connecting external power supply to the shield. But how on earth did it work??
I think your shield will work now.
Sir if we put an obstacle between car and a line so car will stop or not? Please answer as fast as possible!
Hello sir, your video is very informative but I unfortunately cannot access the circuit diagram and code. It will be very kind of you to help me regarding this issue.
Same here
I am doing the same project but having problem of power supply. Which and how many batteries are you using.
two batteries of 3.7v
sir there are alot of errors in ur code plz upload the correct code..
will it work with other motor driver
Bro I have a problem the line following robot is responding to every object instead of black only i tried to change the potentiometer reading by rotating the cube but nothing happens
Try to change the intensity of ir sensor 😁 and brother never use ready made ir sensor coz there vulnerable to light... Better try to make your own one.. And it's really a easy task to make one...
Sir will this work for 1 inch black line
No it won't.i have already tried it.
Hello Sir,
I tried doing same, however, it is going straight. I have checked code and circuit both, which seems fine. Please help me.
Adjust the sensor potentiometer value
Have you got the code then plz also provide me
@@DIYBuilder where to adjust the potentiometer value please reply
can you send me code. thank in advance
@@nguyenthanhhoan4223 it's already given in the description bro
Hello sir can I directly power the adrino board instead of the motor driver ?
no
Very good project 👍
after a single line path if there are two paths to the left and right side then where will it goes???
Hello! Thank you for making this fascinating project! I want to make a project similar to this, but the motor drivers on Amazon do not have pin headers where you plugged in the IR sensors at timestamp 3:03. Did you solder pin headers into your board on the lower right side?
Yes we should just solder it to attach the pin headers to the motor driver board!!!
@@ashwin4369 Thank you for the reply! I actually figured out how to do so and made a robot similar to this one :)
@@joshyough9293 great to hear dude. All the best
@josh I'm trying to build one would you help me in ? plz drop your email then. I really want to learn but I'm a beginner and nothing is looking understandable to me. Im confused :(((
Yes bro but you must female to male jumper cables......
(Male ones into the motor shield
Female ones into the IR sensor)❤️
very cool Way to keep it super light!
Que buen proyecto! Y sin decir una sola palabra 🦾
It was very useful for my project showcasing.
Can you help me in making a maze solver based on ir and arduino
Any one can help me
@@be_a_travellerr yes
What you have put to the table that black strip
Thank You So Much
sir I have a doubt that if i will cut the line then it stop or not...........
The Arduino code that you given below is not gong to work the values of the IR sensor is wrong & THEIR WAS A LOT MORE MISTAKES one of them was the read command
but non of them will show up as errors
which feels like this is intentional
& the code given the description is different from the one he is using
Did u got the right codes ???
Plz copy paste the code here sir plz
I think now it is okay because he wrote updated
yes me too the sensor go crazy
@NikhilVarma I'll try to do so but it is extremely difficult. You have to pause and resume at short intervals.
Where did you buy the Infrared Sensor?
From banggood.com
Hey Bro plz give the code its veey urgent
For this tutorial, we requires these items:
1. Arduino UNO
2. 2WD Smart Car Chasis 2 Wheels
3. Arduino Mini DC Motor Driver Dual H-Bridge PW Control (L293D)
4. IR Line Tracking Sensor (4 bits)
5. Battery
6. Double side tape
7. Wires
8. Jumper wire
9. Black tape
Add TipAsk QuestionCommentDownload
Step 2: Hardware Installation
Hardware Installation
Hardware Installation
1. Assemble the 2WD Smart Car Chasis 2 Wheels
Step 2: Hardware Installation
Hardware Installation
Hardware Installation
1. Assemble the 2WD Smart Car Chasis 2 Wheels
2. Connect the IR sensor to Analog to Digital and Comparator Module
IN1 > IR Sensor 1
IN2 > IR Sensor 2
IN3 > IR Sensor 3
IN4 > IR Sensor 4
3. Then, connect the output pin to Arduino UNO analog pin
OUT1 > A2
OUT2 > A3
OUT3 > A4
OUT4 > A5
4. Connect Vin to 5V and GND to GND in Arduino UNO
5. Then, connect the motor driver pin to Arduino UNO pin
IN1 > D10
IN2 > D9
IN3 > D6
IN4 > D5
6. Connect the both motor to motor driver
Motor A > Right motor
Motor B > Left motorStep 2: Hardware Installation
Hardware Installation
Hardware Installation
1. Assemble the 2WD Smart Car Chasis 2 Wheels
2. Connect the IR sensor to Analog to Digital and Comparator Module
IN1 > IR Sensor 1
IN2 > IR Sensor 2
IN3 > IR Sensor 3
IN4 > IR Sensor 4
3. Then, connect the output pin to Arduino UNO analog pin
OUT1 > A2
OUT2 > A3
OUT3 > A4
OUT4 > A5
4. Connect Vin to 5V and GND to GND in Arduino UNO
5. Then, connect the motor driver pin to Arduino UNO pin
IN1 > D10
IN2 > D9
IN3 > D6
IN4 > D5
6. Connect the both motor to motor driver
Motor A > Right motor
Motor B > Left motor
What is the distance between the two sensors??
Plzz reply fast...
Nothing bro...
Help, will this speed is sufficient for competitions
Bro you are doing a great job. But it would be even better if you start arduino programming classes you will be having lot of viewers
I'll start soon
When will you put the code link
Send me your mail id if you need the code
@@DIYBuilder abdellatifgeek@gmail.com
Tharushanavidu5@gmail.com Plase give me code and digram
Please give me also a code
@@DIYBuilder andrewhanaking@gmail.com
Please give me the code too
Sir online mil jayega kya yah project bana huaa
can you please upload the code! I need it quickly!thanks
Do u have code please send me
It is in the information
will it be ok if our chassis is slightly bigger!?
Would you please provide the code for this build that doesn't have to follow the black line ? I'm building one to go on a pre-build track that's 5ft wide and 10ft long rectangle . The track has 1 ft wide and about 2 ft rectangular round-abound in the middle
خلاقیت حدی مرزی نمی شناسد عابد قاضی زاده
Its in the description, check the 2nd link from the top, from the Google Drive you can download it.!
@@NuzrathSirthen can you pls send it
Could we use dry cell instead of Li ion batteries
Li ion batteries also Dry cell
you can also use AA and AAA cell
How much is cost?
1000+
what did you use to draw the line
Normal Tap or Electric tap
Hello, your video is so clear and well edited and I have made this project. The problem I have is the robot is just moving forward and not following the line, can you suggest me some areas I may have done a mistake so I can correct it and make it work😃
Bro how will the robot move by keeping the battery will the car move automatically or we need to have any control or switch??
@@kazakrishnabharadwaj3410 it will just move man.....
@@sashwnsmu477 but by keeping battery also it's not moving
@@sashwnsmu477 may be I need to dump the code before and then the car will move I guess.
ADJUST YOUR IR SENSOR POTENTIOMETER TO LOW, keep it adjusted between reading surface and stop when crossing black line
How much did all the things cost??
1500 bro without wheels
easy to understand, another cool DIY Arduino project form you Mr. Surajit! 👍👍👍
Can you please please please tell me which wires you have used ...
Please tell me the link from Amazon.
bro my model is not moving even after I bugged codes in it
pls give me an idea I'm in hurry
contact me on instagram
Can I know where the dc switch is used??
Don't buy anything from Banggood. I was ordered there items more than 3 months back. still no update.
which software you use for video editing??
filmora
which version bro??
can you give me the code, please
int vSpeed = 110; // MAX 255
int turn_speed = 230; // MAX 255
int turn_delay = 10;
//L293 Connection
const int motorA1 = 8;
const int motorA2 = 10;
const int motorAspeed = 9;
const int motorB1 = 12;
const int motorB2 = 13;
const int motorBspeed = 11;
//Sensor Connection
const int left_sensor_pin =A0;
const int right_sensor_pin =A1;
int left_sensor_state;
int right_sensor_state;
void setup() {
pinMode(motorA1, OUTPUT);
pinMode(motorA2, OUTPUT);
pinMode(motorB1, OUTPUT);
pinMode(motorB2, OUTPUT);
Serial.begin(9600);
delay(3000);
}
void loop()
{
left_sensor_state = analogRead(left_sensor_pin);
right_sensor_state = analogRead(right_sensor_pin);
if(right_sensor_state > 500 && left_sensor_state < 500)
{
Serial.println("turning right");
digitalWrite (motorA1,LOW);
digitalWrite(motorA2,HIGH);
digitalWrite (motorB1,LOW);
digitalWrite(motorB2,HIGH);
analogWrite (motorAspeed, vSpeed);
analogWrite (motorBspeed, turn_speed);
}
if(right_sensor_state < 500 && left_sensor_state > 500)
{
Serial.println("turning left");
digitalWrite (motorA1,HIGH);
digitalWrite(motorA2,LOW);
digitalWrite (motorB1,HIGH);
digitalWrite(motorB2,LOW);
analogWrite (motorAspeed, turn_speed);
analogWrite (motorBspeed, vSpeed);
delay(turn_delay);
}
if(right_sensor_state > 500 && left_sensor_state > 500)
{
Serial.println("going forward");
digitalWrite (motorA2,LOW);
digitalWrite(motorA1,HIGH);
digitalWrite (motorB2,HIGH);
digitalWrite(motorB1,LOW);
analogWrite (motorAspeed, vSpeed);
analogWrite (motorBspeed, vSpeed);
delay(turn_delay);
}
if(right_sensor_state < 500 && left_sensor_state < 500)
{
Serial.println("stop");
analogWrite (motorAspeed, 0);
analogWrite (motorBspeed, 0);
}
}
This is the coad
Plz reply
Can I use dc motor instead of wheel gear
Wow😲Amazing bro
just like ur mother
Plz answer me can we make line follower and obstacle avoiding on this driver ??????
Yes you can but you have to modify the code according to this motor driver
@@DIYBuilder I need the code , can u help me plz ?
Great you make it an awesome way.
Sir what's that line made of its a normal tap or a different material
NORMAL TAP
Can anyone please give me the code of this arduino programme?
drive.google.com/file/d/1lddLLnkmZmYjjvB-nVPX45FV_P5i783T/view
for ppl asking for the code , he showed it in the video , i just typed it as it is
Adam Anas Contact he showed the codes too fast can you please send me the full code
@@tansanemusic I commented the code below , email me at anasadamcontact@gmail.com if u can't see it here
Which software do you use to edit the videos?
Supper great job Bro 👌
Thanks bro
sir i want to make this in my school exhibition pls send code and circuit diagram please it's urgent
Have you got code
Plz share code
It's already in the description
What is total budget
Can you upload the code... I need the code
drive.google.com/file/d/1lddLLnkmZmYjjvB-nVPX45FV_P5i783T/view
drive.google.com/file/d/1lddLLnkmZmYjjvB-nVPX45FV_P5i783T/view
@@devansh6816 the file is not opening
Hi! May we know what is the screw size and where can we buy one? Thank you.
in your local area Hardware shop
brother i want code for that
sir it's possible to use 5 or 6 volt battery?
İ dont think son but u can try i just do with 9v battery but its need push
It's really important to me
Yah Project humko kharidna hai ऑनलाइन milega kya??
waiting for the links of the codes. thank you in advance.
Send me your mail id
Tharushanavidu5@gmail.com
@@DIYBuilder wafaa.volunteer@gmail.com me too please
@@DIYBuilder bundalianallen6@gmail.com. This is my email thank you again
Seriryousra@gmail.com
Send me the code please i need it for my project in my high scool and i haven't time please help meee 😢😢😢
Can we connect 4 ..12v dc Johnson motor with 12v power supply on it
I need code
mail id please
Did you get the code if yes then please email it to me with the link
did u get the code ? send me please
@@Victor-hb2hi nooo I am waiting!!!
@@abdulrahmanayman4264 i need the code
how your arduino is powered? for me the battery only power the motor shield
the uploaded code is apiece of crap D:
iT'S TRUE.
YOU CAN USE THIS. I USED 2 MOTORS. OF COURSE, I AM A NOOB AND THIS IS JUST A SMAR COPY PASTE REPLACE EDIT. dOWNLOAD THE ADAFUIT GITHUB FIRST.
#include
//MOTOR DEFINATION
AF_DCMotor motor1(1);
AF_DCMotor motor4(4);
//Sensor Connection
const int left_sensor_pin =A0;
const int right_sensor_pin =A1;
int left_sensor_state;
int right_sensor_state;
void setup() {
left_sensor_state = analogRead(left_sensor_pin);
right_sensor_state = analogRead(right_sensor_pin);
motor1.setSpeed(180);
motor4.setSpeed(180);
motor1.run(RELEASE);
motor4.run(RELEASE);
Serial.begin(9600);
delay(3000);
}
void loop() {
left_sensor_state = analogRead(left_sensor_pin);
right_sensor_state = analogRead(right_sensor_pin);
if(right_sensor_state > 500 && left_sensor_state < 500)
{
Serial.println("turning left");
motor1.run(RELEASE);
motor4.run(FORWARD);
}
if(right_sensor_state < 500 && left_sensor_state > 500)
{
Serial.println("turning right");
motor1.run(BACKWARD);
motor4.run(RELEASE);
}
if(right_sensor_state > 500 && left_sensor_state > 500)
{
Serial.println("going forward");
motor1.run(RELEASE);
motor4.run(RELEASE);
}
if(right_sensor_state < 500 && left_sensor_state < 500)
{
Serial.println("stop");
motor1.run(FORWARD);
motor4.run(FORWARD);
}
}
@@testname367 W8888888888888888888888 this REALLY works??????????????????????????
@@testname367 Where are motors 2 and 3? u r basically using just 2 motors for a 4 wheeled vehicle. U r not specifying what colour IR Sensors are supposed to be following. There are a million other mistakes. This code is wrong on so many levels!!! No offence but I don't really think it will work.
Hey are all the codes nd library given and is there any extra folders needed to be downloaded??
Pls sir tell the code
Watch my video for right code ua-cam.com/video/zG119YG-xfs/v-deo.html
Bro where did u use ultrasonic sensor
Plz send me the code brother
@DIY Builder
Are this robot follow all kind of trackes or only that one's which shown in video. Are your code for this is able to follow other trackes or only this one's???
Hello sir can I also obstracle avoidance in this robot with the line follower ..pls make a video on it
For obstacle avoiding you have to use ultrasonic sensor
2:25, that's not gonna work xD
why???
@@hirenkanojia5438 the left wire isn't connected
shutup noob
How fast in the motor used in your robot? Can we order this along with the code?
sir can you send me code please.
in description
If do line follower car using PLC,its components are still same?
friend help me with the arduino code
Watch my video for right code ua-cam.com/video/zG119YG-xfs/v-deo.html
good job