How To Make A DIY Arduino Obstacle Avoiding Car For Science Project
ฝัง
- เผยแพร่เมื่อ 28 ก.ย. 2024
- How To Make A DIY Arduino Obstacle Avoiding Car At Home Robot For Science Project
Hello Guys, In this tutorial, I am going to show you how to make a DIY Arduino Obstacle Avoiding Car. So let's get started :) { With Subtitles }
------------------------------------------------------------
👇Materials used in the video with buying links 👇
*Arduino Uno - amzn.to/2TV1C1J
*Motor Driver Shield - amzn.to/30QgkIM
*Gear Motor and Wheels - amzn.to/2NZqwJB
*Servo Motor - amzn.to/2uBFjmT
*Ultrasonic Sensor -amzn.to/2GlQcfx
*Pin Header Connector - amzn.to/2RJTJcI
* Soldering Iron 25w : amzn.to/2M4O7Lf
* Soldering Iron 60w : amzn.to/3pug9NW
* Hot Melt Glue Gun 40 Watt : amzn.to/3bqK44O
*18650 Li-on Battery - amzn.to/2GnJtBz
*18650 Battery Holder - amzn.to/2NY2DCi
*Male and Female Jumper wire -amzn.to/2ZCXhj9
*Multiwood Sheet - (Offline Store)
------------------------------------------------------------
Code link : drive.google.c... | share this video maximum.
------------------------------------------------------------
Facebook Page : / g-4-genius-17926710477...
Follow on Instagram : www.instagram....
------------------------------------------------------------
If you love watching my content then don't forget to
👍like the video
🔗share the video with your friends
👇put your feedback/queries down in the comment section, I would love to check it out
THANK U FOR WATCHING
1-SUBSCRIBE AND VISIT
2-LIKE
3-SHARE
4- COMMENT
#GLENTECH #glentech #DIY #ArduinoProject #SmartRobot #ArduinoRobot #ArduinoCar
CODE :
//ARDUINO OBSTACLE AVOIDING CAR//
// Before uploading the code you have to install the necessary library//
//AFMotor Library learn.adafruit.com/adafruit-motor-shield/library-install //
//NewPing Library github.com/livetronic/Arduino-NewPing//
//Servo Library github.com/arduino-libraries/Servo.git //
// To Install the libraries go to sketch >> Include Library >> Add .ZIP File >> Select the Downloaded ZIP files From the Above links //
#include
#include
#include
#define TRIG_PIN A0
#define ECHO_PIN A1
#define MAX_DISTANCE 200
#define MAX_SPEED 190 // sets speed of DC motors
#define MAX_SPEED_OFFSET 20
NewPing sonar(TRIG_PIN, ECHO_PIN, MAX_DISTANCE);
AF_DCMotor motor1(1, MOTOR12_1KHZ);
AF_DCMotor motor2(2, MOTOR12_1KHZ);
AF_DCMotor motor3(3, MOTOR34_1KHZ);
AF_DCMotor motor4(4, MOTOR34_1KHZ);
Servo myservo;
boolean goesForward=false;
int distance = 100;
int speedSet = 0;
void setup() {
myservo.attach(10);
myservo.write(115);
delay(2000);
distance = readPing();
delay(100);
distance = readPing();
delay(100);
distance = readPing();
delay(100);
distance = readPing();
delay(100);
}
void loop() {
int distanceR = 0;
int distanceL = 0;
delay(40);
if(distance=distanceL)
{
turnRight();
moveStop();
}else
{
turnLeft();
moveStop();
}
}else
{
moveForward();
}
distance = readPing();
}
int lookRight()
{
myservo.write(50);
delay(500);
int distance = readPing();
delay(100);
myservo.write(115);
return distance;
}
Read it :
Before uploading the code you have to install the necessary library given below :
//AFMotor Library learn.adafruit.com/adafruit-motor-shield/library-install //
//NewPing Library github.com/livetronic/Arduino-NewPing//
//Servo Library github.com/arduino-libraries/Servo.git //
// To Install the libraries go to sketch >> Include Library >> Add .ZIP File >> Select the Downloaded ZIP files From the Above links //
How to code in mobile : th-cam.com/video/Mw589orCT3c/w-d-xo.html
@UNKNOWN ADIL this first comment is the code . Click read more to see
@UNKNOWN ADIL file link : drive.google.com/file/d/1Sjspsz2em8Thq_8WhalYu_YcsMar9z60/view
Hi Glen tech 6 wheeled arduino obstacle avoiding car undakkan patto pls reply 🙏🙏
Just connect 5th and 6th motor with 3rd and 4th motor.
കൊള്ളാം കേട്ടോ.. പ്രോഗ്രാമിങിനോട് നല്ല താല്പര്യം ഉണ്ടെങ്കിൽ ഇപ്പഴേ കോഡു optimize ചെയ്തു പഠിച്ചോ കേട്ടോ.. ഇതിൽ ലൈഫ്റ് path ഓപ്പൺ ആണെങ്കിൽ പോലും ബാക്കി directions പോൾ ചെയ്യുന്നുണ്ടല്ലോ? സ്റ്റുഡന്റ്സ് പ്രോജക്ട് ഒക്കെ ഇങ്ങനെ ചെയ്താൽ മതി. പക്ഷെ ചെയ്യുമ്പോൾ size,time എപ്പോഴും മനസിൽ കണ്ടേ കോഡ് ചെയ്യാവൂ... കൂടുതൽ രസകരമായ ഇതുപോലത്തെ പ്രോജക്ടുകൾ പ്രതീക്ഷിക്കുന്നു.
Thankyou dear friend for your valuable comment and support 🙂
ചേട്ടന്റെ ചാനലും അടിപൊളിയാണ്
We can use any colour jumper wire
Yes
We can use any colour jumper wire for ultrasonic sensors
Colours are just for identifying the pins . You can use any color
😍 👏👏
Expecting more Arduino, Raspberry Pi projects..
BEST WISHES..
Thankyou dear friend for your valuable comment and support 🙂
Cheta I am Siddharth 12 years old. SEEING your video i bought all the parts for making aurdino robot spending so much money. I assembled all the parts, then connected to the computer. But I am unable to press the PORT button in computer. I wanted to surprise my parents n friends, but all went in waste. I also wanted to do your other projects. Pl help me out
Use mobile then. th-cam.com/video/Mw589orCT3c/w-d-xo.html
Bro can we make it by using Male wires without using Pin header connector
Yes , need to solder the wire
@@GLENTECH thanks bro
Share my videos with your friends
We can use evine rechargeable batteries 2000mah
6v to 12v batteries can only be used.
This all files can use for all robort or yours only
You can use this code for making Arduino obstacles avoiding car .
AF Motor like that files can be used for any Arduino projects.
Hey Nice video.
I got some problems. My motors wont rotate by theirselves. I need to rotate them first by hand before they turn. Im using 9v battery
The cable connect to the motor board is loose sometimes .
Try uploading code again
@@GLENTECH do you mean the driver?
@@GLENTECH is 9v battery a good power supply?
@@heliumnitrogensquared9422 9 v battery is good but run Time is less
Hi Glen tech i have a doubt should we on the motor driver shield while coding
No need.
how can we decrease speed of the gear motor?
In code speed of motor given , decrease the value and upload code again.
Sir i used 4 1.5 volts batery my robot was not working in the grund and servo also not rotate
If you need you can use four 1.5 volts 1000 mAh rechargable battery . Because normal 1.5 battery mAh is less and it won't work .
Recommended to use two 3.7v 2500mAh rechargable battery .
1.5v : www.amazon.in/dp/B00BN5SNF0/ref=cm_sw_r_cp_apa_fabc_62EJQGX1NMMVSF6V3VTJ
3.7v : www.amazon.in/dp/B08T1XRRG5/ref=cm_sw_r_cp_apa_fabc_AAZJRWZQEVR96XNH19Z6?psc=1
thank you sir you are great
does it work but mg90s 180 degrees servo motor?
?
@@GLENTECH does it work with*** mg90s servo motor (180 degrees)
Yes
@@GLENTECH 180 degrees or 360 degrees?????
180
Hi Glen tech 6 wheeled arduino obstacle avoiding robot undakumbol gear motors 5 and 6 arduinoyumayi connect cheyyano pls 🙏 reply
Connect with motor module. Connect 3rd and 5th motor together .
Connect 4th and 6th motor together.
See the video to know connection
Ok ethra volt battery upayogikkanam
@@shibusivadas7561 you can use same battery showing in the video.
Ok
Sir hamko code dalane nhi aa raha hai code dalane ka vedio banao
th-cam.com/video/Mw589orCT3c/w-d-xo.html
I want to make it but the battery link in discription not working
Battery link : www.amazon.in/dp/B085XL78L3/ref=cm_sw_r_apa_i_IiICEbMHS3E22
In every electronics shops it's available.
Thank you Glen
E code mobile phone il download cheyan pachunillalo. Mobile phone code ayachu taramo
th-cam.com/video/Mw589orCT3c/w-d-xo.html
Code I have given as first comment .
Ciruct diagram undo
Link in video discription
Hawsome bro
Obstacles avoiding robot
Hi
My servo motor is on
But my wheel motors r not on
//ARDUINO OBSTACLE AVOIDING CAR//
// Before uploading the code you have to install the necessary library//
//AFMotor Library learn.adafruit.com/adafruit-motor-shield/library-install //
//NewPing Library github.com/livetronic/Arduino-NewPing//
//Servo Library github.com/arduino-libraries/Servo.git //
// To Install the libraries go to sketch >> Include Library >> Add .ZIP File >> Select the Downloaded ZIP files From the Above links //
#include
#include
#include
#define TRIG_PIN A0
#define ECHO_PIN A1
#define MAX_DISTANCE 200
#define MAX_SPEED 190 // sets speed of DC motors
#define MAX_SPEED_OFFSET 20
NewPing sonar(TRIG_PIN, ECHO_PIN, MAX_DISTANCE);
AF_DCMotor motor1(1, MOTOR12_1KHZ);
AF_DCMotor motor2(2, MOTOR12_1KHZ);
AF_DCMotor motor3(3, MOTOR34_1KHZ);
AF_DCMotor motor4(4, MOTOR34_1KHZ);
Servo myservo;
boolean goesForward=false;
int distance = 100;
int speedSet = 0;
void setup() {
myservo.attach(10);
myservo.write(115);
delay(2000);
distance = readPing();
delay(100);
distance = readPing();
delay(100);
distance = readPing();
delay(100);
distance = readPing();
delay(100);
}
void loop() {
int distanceR = 0;
int distanceL = 0;
delay(40);
if(distance=distanceL)
{
turnRight();
moveStop();
}else
{
turnLeft();
moveStop();
}
}else
{
moveForward();
}
distance = readPing();
}
int lookRight()
{
myservo.write(50);
delay(500);
int distance = readPing();
delay(100);
myservo.write(115);
return distance;
}
int lookLeft()
{
myservo.write(170);
delay(500);
int distance = readPing();
delay(100);
myservo.write(115);
return distance;
delay(100);
}
int readPing() {
delay(70);
int cm = sonar.ping_cm();
if(cm==0)
{
cm = 250;
}
return cm;
}
void moveStop() {
motor1.run(RELEASE);
motor2.run(RELEASE);
motor3.run(RELEASE);
motor4.run(RELEASE);
}
void moveForward() {
if(!goesForward)
{
goesForward=true;
motor1.run(FORWARD);
motor2.run(FORWARD);
motor3.run(FORWARD);
motor4.run(FORWARD);
for (speedSet = 0; speedSet < MAX_SPEED; speedSet +=2) // slowly bring the speed up to avoid loading down the batteries too quickly
{
motor1.setSpeed(speedSet);
motor2.setSpeed(speedSet);
motor3.setSpeed(speedSet);
motor4.setSpeed(speedSet);
delay(5);
}
}
}
void moveBackward() {
goesForward=false;
motor1.run(BACKWARD);
motor2.run(BACKWARD);
motor3.run(BACKWARD);
motor4.run(BACKWARD);
for (speedSet = 0; speedSet < MAX_SPEED; speedSet +=2) // slowly bring the speed up to avoid loading down the batteries too quickly
{
motor1.setSpeed(speedSet);
motor2.setSpeed(speedSet);
motor3.setSpeed(speedSet);
motor4.setSpeed(speedSet);
delay(5);
}
}
void turnRight() {
motor1.run(FORWARD);
motor2.run(FORWARD);
motor3.run(BACKWARD);
motor4.run(BACKWARD);
delay(500);
motor1.run(FORWARD);
motor2.run(FORWARD);
motor3.run(FORWARD);
motor4.run(FORWARD);
}
void turnLeft() {
motor1.run(BACKWARD);
motor2.run(BACKWARD);
motor3.run(FORWARD);
motor4.run(FORWARD);
delay(500);
motor1.run(FORWARD);
motor2.run(FORWARD);
motor3.run(FORWARD);
motor4.run(FORWARD);
}
Use this code
3.7 volt battery
Series connection ano
Parlllel connection ano
Series connection
Good
very nice video
i uploaded the code but servo is not moving when ultrasonic sensor sense
// Before uploading the code you have to install the necessary library//
//AFMotor Library learn.adafruit.com/adafruit-motor-shield/library-install //
//NewPing Library github.com/livetronic/Arduino-NewPing//
//Servo Library github.com/arduino-libraries/Servo.git //
// To Install the libraries go to sketch >> Include Library >> Add .ZIP File >> Select the Downloaded ZIP files From the Above links //
read ping is not included in the scope it is saying status 1
Read it
// Before uploading the code you have to install the necessary library//
//AFMotor Library learn.adafruit.com/adafruit-motor-shield/library-install //
//NewPing Library github.com/livetronic/Arduino-NewPing//
//Servo Library github.com/arduino-libraries/Servo.git //
// To Install the libraries go to sketch >> Include Library >> Add .ZIP File >> Select the Downloaded ZIP files From the Above links //
Bro mulitiwood evidaya kittuka
Glass and plywood selling shops
@@GLENTECH
Price ethraya
Mulitiwood price is very less . Below 100
Bro what is the accurate of the rpm of the bo motor bro please
Which motor , servo or gear .
Gear
വർക്ക് cheyyunnilla
Add code correctly
bro i made it but in my one only left 2 motors working
can u solve the problem
Check the motor wire connection
@@GLENTECH thanks bro
എന്റെ വീഡിയോസ് ഫ്രണ്ട്സിന് ഒക്കെ ഒന്ന് ഷെയർ ചെയ്തു കൊടുക്കണം
bro i changed the wire therminals but now all 4 motors dont work
Sometimes code problems
Wow
Thanks bro
@@GLENTECH welcome
Can u just connect the pins with hot glue
Which pins ?
The ones u connected to the board to connect the sensor
Why is my other motors not moving the motors near the battery move but the other two don’t
@@minecraftvideos3435 yes u can connect sensor cable using hot glue
Before uploading the code you have to install the necessary library
//AFMotor Library learn.adafruit.com/adafruit-motor-shield/library-install //
//NewPing Library github.com/livetronic/Arduino-NewPing//
//Servo Library github.com/arduino-libraries/Servo.git //
// To Install the libraries go to sketch >> Include Library >> Add .ZIP File >> Select the Downloaded ZIP files From the Above links //
Arduino enna aa folderile ino file open aakan pattunillaaa
Before uploading the code you have to install the necessary library//
//AFMotor Library learn.adafruit.com/adafruit-motor-shield/library-install //
//NewPing Library github.com/livetronic/Arduino-NewPing//
//Servo Library github.com/arduino-libraries/Servo.git //
Download this 3 files and open documents , Arduino folder , library folder and paste 3 files in it
Download this software : www.win-rar.com/start.html?&L=0
@@GLENTECH bro servo motor move chuyunund but sensor vechalum illalelum orupola
//ARDUINO OBSTACLE AVOIDING CAR//
#include
#include
#include
#define TRIG_PIN A0
#define ECHO_PIN A1
#define MAX_DISTANCE 200
#define MAX_SPEED 190 // sets speed of DC motors
#define MAX_SPEED_OFFSET 20
NewPing sonar(TRIG_PIN, ECHO_PIN, MAX_DISTANCE);
AF_DCMotor motor1(1, MOTOR12_1KHZ);
AF_DCMotor motor2(2, MOTOR12_1KHZ);
AF_DCMotor motor3(3, MOTOR34_1KHZ);
AF_DCMotor motor4(4, MOTOR34_1KHZ);
Servo myservo;
boolean goesForward=false;
int distance = 100;
int speedSet = 0;
void setup() {
myservo.attach(10);
myservo.write(115);
delay(2000);
distance = readPing();
delay(100);
distance = readPing();
delay(100);
distance = readPing();
delay(100);
distance = readPing();
delay(100);
}
void loop() {
int distanceR = 0;
int distanceL = 0;
delay(40);
if(distance=distanceL)
{
turnRight();
moveStop();
}else
{
turnLeft();
moveStop();
}
}else
{
moveForward();
}
distance = readPing();
}
int lookRight()
{
myservo.write(50);
delay(500);
int distance = readPing();
delay(100);
myservo.write(115);
return distance;
}
int lookLeft()
{
myservo.write(170);
delay(500);
int distance = readPing();
delay(100);
myservo.write(115);
return distance;
delay(100);
}
int readPing() {
delay(70);
int cm = sonar.ping_cm();
if(cm==0)
{
cm = 250;
}
return cm;
}
void moveStop() {
motor1.run(RELEASE);
motor2.run(RELEASE);
motor3.run(RELEASE);
motor4.run(RELEASE);
}
void moveForward() {
if(!goesForward)
{
goesForward=true;
motor1.run(FORWARD);
motor2.run(FORWARD);
motor3.run(FORWARD);
motor4.run(FORWARD);
for (speedSet = 0; speedSet < MAX_SPEED; speedSet +=2) // slowly bring the speed up to avoid loading down the batteries too quickly
{
motor1.setSpeed(speedSet);
motor2.setSpeed(speedSet);
motor3.setSpeed(speedSet);
motor4.setSpeed(speedSet);
delay(5);
}
}
}
void moveBackward() {
goesForward=false;
motor1.run(BACKWARD);
motor2.run(BACKWARD);
motor3.run(BACKWARD);
motor4.run(BACKWARD);
for (speedSet = 0; speedSet < MAX_SPEED; speedSet +=2) // slowly bring the speed up to avoid loading down the batteries too quickly
{
motor1.setSpeed(speedSet);
motor2.setSpeed(speedSet);
motor3.setSpeed(speedSet);
motor4.setSpeed(speedSet);
delay(5);
}
}
void turnRight() {
motor1.run(FORWARD);
motor2.run(FORWARD);
motor3.run(BACKWARD);
motor4.run(BACKWARD);
delay(500);
motor1.run(FORWARD);
motor2.run(FORWARD);
motor3.run(FORWARD);
motor4.run(FORWARD);
}
void turnLeft() {
motor1.run(BACKWARD);
motor2.run(BACKWARD);
motor3.run(FORWARD);
motor4.run(FORWARD);
delay(500);
motor1.run(FORWARD);
motor2.run(FORWARD);
motor3.run(FORWARD);
motor4.run(FORWARD);
}
@@GLENTECH bro speed korkune engana
When i see the diagram i understood that we can use 9v battery
But u are using 2000mah rechargeable battery
I'm using 18650 battery , not AA type batteries.
Total expenses??
Below 4000
Bro arodino alla, arduino ennann pronunciation
Start a channel and make videos and teach people about pronunciation . You have a great future . All the best 🙂
@@GLENTECH of course 😆
Code dalana
Code link in video description , download that file
കൊള്ളാം
Thankyou 🙂
How to download arduino in computer
www.arduino.cc/en/Main/Donate
ആകെ ചെലവ് എത്രയാണ്
2500 below
Ok thanks
Thankyou dear friend for your valuable comment and support 🙂
എന്റെ വീഡിയോസ് ഫ്രണ്ട്സിന് ഒക്കെ ഒന്ന് ഷെയർ ചെയ്തു കൊടുക്കണം
How to recharge battery
You need to buy a battery charger or you need make one .
How to make a charger video I will upload next day .
TP-4056 is a charging module for 18650 li-ion batteries
@@lokeshlucky7593 yes
But again the motor run only in 360 degree.....
Yes , but it will turn by rotating one side .
ആ ഫയൽ എല്ലാം ഫോൺ വെച്ചു cheyan പറ്റുമോ.. പറ്റുമെങ്കിൽ ഒരു വീഡിയോ ഇടാമോ. പ്ലീസ്
See this video th-cam.com/video/oA5ljKBXdrc/w-d-xo.html
Ushaar
Thankyou dear friend for your valuable comment and support 🙂
Chetta code link thaa
Nice joke
Code false
Did you copy and paste other files to Arduino folder in my documents
//ARDUINO OBSTACLE AVOIDING CAR//
// Before uploading the code you have to install the necessary library//
//AFMotor Library learn.adafruit.com/adafruit-motor-shield/library-install //
//NewPing Library github.com/livetronic/Arduino-NewPing//
//Servo Library github.com/arduino-libraries/Servo.git //
// To Install the libraries go to sketch >> Include Library >> Add .ZIP File >> Select the Downloaded ZIP files From the Above links //
#include
#include
#include
#define TRIG_PIN A0
#define ECHO_PIN A1
#define MAX_DISTANCE 200
#define MAX_SPEED 190 // sets speed of DC motors
#define MAX_SPEED_OFFSET 20
NewPing sonar(TRIG_PIN, ECHO_PIN, MAX_DISTANCE);
AF_DCMotor motor1(1, MOTOR12_1KHZ);
AF_DCMotor motor2(2, MOTOR12_1KHZ);
AF_DCMotor motor3(3, MOTOR34_1KHZ);
AF_DCMotor motor4(4, MOTOR34_1KHZ);
Servo myservo;
boolean goesForward=false;
int distance = 100;
int speedSet = 0;
void setup() {
myservo.attach(10);
myservo.write(115);
delay(2000);
distance = readPing();
delay(100);
distance = readPing();
delay(100);
distance = readPing();
delay(100);
distance = readPing();
delay(100);
}
void loop() {
int distanceR = 0;
int distanceL = 0;
delay(40);
if(distance=distanceL)
{
turnRight();
moveStop();
}else
{
turnLeft();
moveStop();
}
}else
{
moveForward();
}
distance = readPing();
}
int lookRight()
{
myservo.write(50);
delay(500);
int distance = readPing();
delay(100);
myservo.write(115);
return distance;
}
int lookLeft()
{
myservo.write(170);
delay(500);
int distance = readPing();
delay(100);
myservo.write(115);
return distance;
delay(100);
}
int readPing() {
delay(70);
int cm = sonar.ping_cm();
if(cm==0)
{
cm = 250;
}
return cm;
}
void moveStop() {
motor1.run(RELEASE);
motor2.run(RELEASE);
motor3.run(RELEASE);
motor4.run(RELEASE);
}
void moveForward() {
if(!goesForward)
{
goesForward=true;
motor1.run(FORWARD);
motor2.run(FORWARD);
motor3.run(FORWARD);
motor4.run(FORWARD);
for (speedSet = 0; speedSet < MAX_SPEED; speedSet +=2) // slowly bring the speed up to avoid loading down the batteries too quickly
{
motor1.setSpeed(speedSet);
motor2.setSpeed(speedSet);
motor3.setSpeed(speedSet);
motor4.setSpeed(speedSet);
delay(5);
}
}
}
void moveBackward() {
goesForward=false;
motor1.run(BACKWARD);
motor2.run(BACKWARD);
motor3.run(BACKWARD);
motor4.run(BACKWARD);
for (speedSet = 0; speedSet < MAX_SPEED; speedSet +=2) // slowly bring the speed up to avoid loading down the batteries too quickly
{
motor1.setSpeed(speedSet);
motor2.setSpeed(speedSet);
motor3.setSpeed(speedSet);
motor4.setSpeed(speedSet);
delay(5);
}
}
void turnRight() {
motor1.run(FORWARD);
motor2.run(FORWARD);
motor3.run(BACKWARD);
motor4.run(BACKWARD);
delay(500);
motor1.run(FORWARD);
motor2.run(FORWARD);
motor3.run(FORWARD);
motor4.run(FORWARD);
}
void turnLeft() {
motor1.run(BACKWARD);
motor2.run(BACKWARD);
motor3.run(FORWARD);
motor4.run(FORWARD);
delay(500);
motor1.run(FORWARD);
motor2.run(FORWARD);
motor3.run(FORWARD);
motor4.run(FORWARD);
}
Noo !
Ah okey thx you can you help me to my other project i will use 4wd arduino car with bluetooth hc 06 and ultrasonic sensor with servo motor please brother
Then copy and paste that 3 folders into Arduino folder in my documents
Servo ans sensor is not rotattinv
Read it
// Before uploading the code you have to install the necessary library//
//AFMotor Library learn.adafruit.com/adafruit-motor-shield/library-install //
//NewPing Library github.com/livetronic/Arduino-NewPing//
//Servo Library github.com/arduino-libraries/Servo.git //
// To Install the libraries go to sketch >> Include Library >> Add .ZIP File >> Select the Downloaded ZIP files From the Above links //
YOU ARE GREAT 👍 but i upload code they show error please help🙏 me i request you
Helpme!
Read it
// Before uploading the code you have to install the necessary library//
//AFMotor Library learn.adafruit.com/adafruit-motor-shield/library-install //
//NewPing Library github.com/livetronic/Arduino-NewPing//
//Servo Library github.com/arduino-libraries/Servo.git //
// To Install the libraries go to sketch >> Include Library >> Add .ZIP File >> Select the Downloaded ZIP files From the Above links //
@@GLENTECH bhi nahi ho raha hai please make a video on download files please🙏 make video I wish you have 50 million subscribe please make video
To Install :
open my documents folder , then open Arduino folder , then open libraries folder and paste AFmotor , NewPing , Servo folder into it .
download it from below :
//AFMotor Library learn.adafruit.com/adafruit-motor-shield/library-install //
//NewPing Library github.com/livetronic/Arduino-NewPing//
//Servo Library github.com/arduino-libraries/Servo.git //
@@GLENTECH bhai nahi samja please make video bhi
Jab mai link khualta hu to 5 file download ka option he nahi aata please🙏 make video
th-cam.com/video/Mw589orCT3c/w-d-xo.html
Can i use arduino uno R3 SMD Atmega328p board clone compatible model plz. Reply
make obstrakle avoiding and line following togerther
I made this but the motors start to beep when i attach the battery.
Pls hlp bro
CODE :
//ARDUINO OBSTACLE AVOIDING CAR//
// Before uploading the code you have to install the necessary library//
//AFMotor Library learn.adafruit.com/adafruit-motor-shield/library-install //
//NewPing Library github.com/livetronic/Arduino-NewPing//
//Servo Library github.com/arduino-libraries/Servo.git //
// To Install the libraries go to sketch >> Include Library >> Add .ZIP File >> Select the Downloaded ZIP files From the Above links //
#include
#include
#include
#define TRIG_PIN A0
#define ECHO_PIN A1
#define MAX_DISTANCE 200
#define MAX_SPEED 190 // sets speed of DC motors
#define MAX_SPEED_OFFSET 20
NewPing sonar(TRIG_PIN, ECHO_PIN, MAX_DISTANCE);
AF_DCMotor motor1(1, MOTOR12_1KHZ);
AF_DCMotor motor2(2, MOTOR12_1KHZ);
AF_DCMotor motor3(3, MOTOR34_1KHZ);
AF_DCMotor motor4(4, MOTOR34_1KHZ);
Servo myservo;
boolean goesForward=false;
int distance = 100;
int speedSet = 0;
void setup() {
myservo.attach(10);
myservo.write(115);
delay(2000);
distance = readPing();
delay(100);
distance = readPing();
delay(100);
distance = readPing();
delay(100);
distance = readPing();
delay(100);
}
void loop() {
int distanceR = 0;
int distanceL = 0;
delay(40);
if(distance=distanceL)
{
turnRight();
moveStop();
}else
{
turnLeft();
moveStop();
}
}else
{
moveForward();
}
distance = readPing();
}
int lookRight()
{
myservo.write(50);
delay(500);
int distance = readPing();
delay(100);
myservo.write(115);
return distance;
}
@@GLENTECH When i entered the code it says that readPing was not declared in this scope. What should i do?
@@aryavats5403
Read it .
Before uploading the code you have to install the necessary library//
//AFMotor Library learn.adafruit.com/adafruit-motor-shield/library-install //
//NewPing Library github.com/livetronic/Arduino-NewPing//
//Servo Library github.com/arduino-libraries/Servo.git //
// To Install the libraries go to sketch >> Include Library >> Add .ZIP File >> Select the Downloaded ZIP files From the Above links //
@@GLENTECH i already have theses libraries installed.
We can put 15 pin header
Bro pls tell me ...all the connections are correct....but motor are not rotating.........
// Before uploading the code you have to install the necessary library//
//AFMotor Library learn.adafruit.com/adafruit-motor-shield/library-install //
//NewPing Library github.com/livetronic/Arduino-NewPing//
//Servo Library github.com/arduino-libraries/Servo.git //
// To Install the libraries go to sketch >> Include Library >> Add .ZIP File >> Select the Downloaded ZIP files From the Above links //
sir the code from your link is unable to use
//ARDUINO OBSTACLE AVOIDING CAR//
// Before uploading the code you have to install the necessary library//
//AFMotor Library learn.adafruit.com/adafruit-motor-shield/library-install //
//NewPing Library github.com/livetronic/Arduino-NewPing//
//Servo Library github.com/arduino-libraries/Servo.git //
// To Install the libraries go to sketch >> Include Library >> Add .ZIP File >> Select the Downloaded ZIP files From the Above links //
#include
#include
#include
#define TRIG_PIN A0
#define ECHO_PIN A1
#define MAX_DISTANCE 200
#define MAX_SPEED 190 // sets speed of DC motors
#define MAX_SPEED_OFFSET 20
NewPing sonar(TRIG_PIN, ECHO_PIN, MAX_DISTANCE);
AF_DCMotor motor1(1, MOTOR12_1KHZ);
AF_DCMotor motor2(2, MOTOR12_1KHZ);
AF_DCMotor motor3(3, MOTOR34_1KHZ);
AF_DCMotor motor4(4, MOTOR34_1KHZ);
Servo myservo;
boolean goesForward=false;
int distance = 100;
int speedSet = 0;
void setup() {
myservo.attach(10);
myservo.write(115);
delay(2000);
distance = readPing();
delay(100);
distance = readPing();
delay(100);
distance = readPing();
delay(100);
distance = readPing();
delay(100);
}
void loop() {
int distanceR = 0;
int distanceL = 0;
delay(40);
if(distance=distanceL)
{
turnRight();
moveStop();
}else
{
turnLeft();
moveStop();
}
}else
{
moveForward();
}
distance = readPing();
}
int lookRight()
{
myservo.write(50);
delay(500);
int distance = readPing();
delay(100);
myservo.write(115);
return distance;
}
int lookLeft()
{
myservo.write(170);
delay(500);
int distance = readPing();
delay(100);
myservo.write(115);
return distance;
delay(100);
}
int readPing() {
delay(70);
int cm = sonar.ping_cm();
if(cm==0)
{
cm = 250;
}
return cm;
}
void moveStop() {
motor1.run(RELEASE);
motor2.run(RELEASE);
motor3.run(RELEASE);
motor4.run(RELEASE);
}
void moveForward() {
if(!goesForward)
{
goesForward=true;
motor1.run(FORWARD);
motor2.run(FORWARD);
motor3.run(FORWARD);
motor4.run(FORWARD);
for (speedSet = 0; speedSet < MAX_SPEED; speedSet +=2) // slowly bring the speed up to avoid loading down the batteries too quickly
{
motor1.setSpeed(speedSet);
motor2.setSpeed(speedSet);
motor3.setSpeed(speedSet);
motor4.setSpeed(speedSet);
delay(5);
}
}
}
void moveBackward() {
goesForward=false;
motor1.run(BACKWARD);
motor2.run(BACKWARD);
motor3.run(BACKWARD);
motor4.run(BACKWARD);
for (speedSet = 0; speedSet < MAX_SPEED; speedSet +=2) // slowly bring the speed up to avoid loading down the batteries too quickly
{
motor1.setSpeed(speedSet);
motor2.setSpeed(speedSet);
motor3.setSpeed(speedSet);
motor4.setSpeed(speedSet);
delay(5);
}
}
void turnRight() {
motor1.run(FORWARD);
motor2.run(FORWARD);
motor3.run(BACKWARD);
motor4.run(BACKWARD);
delay(500);
motor1.run(FORWARD);
motor2.run(FORWARD);
motor3.run(FORWARD);
motor4.run(FORWARD);
}
void turnLeft() {
motor1.run(BACKWARD);
motor2.run(BACKWARD);
motor3.run(FORWARD);
motor4.run(FORWARD);
delay(500);
motor1.run(FORWARD);
motor2.run(FORWARD);
motor3.run(FORWARD);
motor4.run(FORWARD);
}
Sir but you have to put these libraries in description if you put here most of the people not see properly
@@swamyswami3737 in description there is a link to download these files
Thanks a lot Bro
Hii bro Can You please make a video about how to upload code for this in mobile
How to upload code for arduino obstacle avoidance car in mobile (Arduinodroid)
uploading soon
@@GLENTECH I need To upload code for my arduino in sciencefair
Can we use regular 9v battery or pencil cells
9v battery will work sometimes . Better use two 3.7v rechargable batteries .
Adriuno nano mathiyavooooo
Bro ee file phoneil yahana install chayyunathu
See this video : th-cam.com/video/Mw589orCT3c/w-d-xo.html
Ok cheta thanks
Super video 👍👍 👍...
Thanks bro 🙂
Kitne amh ki
@@iamtechnical3737 3.7v 2500 mAh battery
2000 amh buy Kiya hai
@@iamtechnical3737 2000 mAh no problems
Thankzx
error help me plss
//ARDUINO OBSTACLE AVOIDING CAR//
// Before uploading the code you have to install the necessary library//
//AFMotor Library learn.adafruit.com/adafruit-motor-shield/library-install //
//NewPing Library github.com/livetronic/Arduino-NewPing//
//Servo Library github.com/arduino-libraries/Servo.git //
// To Install the libraries go to sketch >> Include Library >> Add .ZIP File >> Select the Downloaded ZIP files From the Above links //
#include
#include
#include
#define TRIG_PIN A0
#define ECHO_PIN A1
#define MAX_DISTANCE 200
#define MAX_SPEED 190 // sets speed of DC motors
#define MAX_SPEED_OFFSET 20
NewPing sonar(TRIG_PIN, ECHO_PIN, MAX_DISTANCE);
AF_DCMotor motor1(1, MOTOR12_1KHZ);
AF_DCMotor motor2(2, MOTOR12_1KHZ);
AF_DCMotor motor3(3, MOTOR34_1KHZ);
AF_DCMotor motor4(4, MOTOR34_1KHZ);
Servo myservo;
boolean goesForward=false;
int distance = 100;
int speedSet = 0;
void setup() {
myservo.attach(10);
myservo.write(115);
delay(2000);
distance = readPing();
delay(100);
distance = readPing();
delay(100);
distance = readPing();
delay(100);
distance = readPing();
delay(100);
}
void loop() {
int distanceR = 0;
int distanceL = 0;
delay(40);
if(distance=distanceL)
{
turnRight();
moveStop();
}else
{
turnLeft();
moveStop();
}
}else
{
moveForward();
}
distance = readPing();
}
int lookRight()
{
myservo.write(50);
delay(500);
int distance = readPing();
delay(100);
myservo.write(115);
return distance;
}
int lookLeft()
{
myservo.write(170);
delay(500);
int distance = readPing();
delay(100);
myservo.write(115);
return distance;
delay(100);
}
int readPing() {
delay(70);
int cm = sonar.ping_cm();
if(cm==0)
{
cm = 250;
}
return cm;
}
void moveStop() {
motor1.run(RELEASE);
motor2.run(RELEASE);
motor3.run(RELEASE);
motor4.run(RELEASE);
}
void moveForward() {
if(!goesForward)
{
goesForward=true;
motor1.run(FORWARD);
motor2.run(FORWARD);
motor3.run(FORWARD);
motor4.run(FORWARD);
for (speedSet = 0; speedSet < MAX_SPEED; speedSet +=2) // slowly bring the speed up to avoid loading down the batteries too quickly
{
motor1.setSpeed(speedSet);
motor2.setSpeed(speedSet);
motor3.setSpeed(speedSet);
motor4.setSpeed(speedSet);
delay(5);
}
}
}
void moveBackward() {
goesForward=false;
motor1.run(BACKWARD);
motor2.run(BACKWARD);
motor3.run(BACKWARD);
motor4.run(BACKWARD);
for (speedSet = 0; speedSet < MAX_SPEED; speedSet +=2) // slowly bring the speed up to avoid loading down the batteries too quickly
{
motor1.setSpeed(speedSet);
motor2.setSpeed(speedSet);
motor3.setSpeed(speedSet);
motor4.setSpeed(speedSet);
delay(5);
}
}
void turnRight() {
motor1.run(FORWARD);
motor2.run(FORWARD);
motor3.run(BACKWARD);
motor4.run(BACKWARD);
delay(500);
motor1.run(FORWARD);
motor2.run(FORWARD);
motor3.run(FORWARD);
motor4.run(FORWARD);
}
void turnLeft() {
motor1.run(BACKWARD);
motor2.run(BACKWARD);
motor3.run(FORWARD);
motor4.run(FORWARD);
delay(500);
motor1.run(FORWARD);
motor2.run(FORWARD);
motor3.run(FORWARD);
motor4.run(FORWARD);
}
Its coming serial port not selected plz help
8:37 see from here
ചേട്ടാ motor driveil എത്ര volt വരെ കൊടുക്കാം
It's can run motors on 4.5vdc to 25vdc
Bro but the only thing....is servo motor does not rotating.......does it heavy power supply...then means how much power supply is needed...to rotate all the 5 motors....
//ARDUINO OBSTACLE AVOIDING CAR//
// Before uploading the code you have to install the necessary library//
//AFMotor Library learn.adafruit.com/adafruit-motor-shield/library-install //
//NewPing Library github.com/livetronic/Arduino-NewPing//
//Servo Library github.com/arduino-libraries/Servo.git //
// To Install the libraries go to sketch >> Include Library >> Add .ZIP File >> Select the Downloaded ZIP files From the Above links //
#include
#include
#include
#define TRIG_PIN A0
#define ECHO_PIN A1
#define MAX_DISTANCE 200
#define MAX_SPEED 190 // sets speed of DC motors
#define MAX_SPEED_OFFSET 20
NewPing sonar(TRIG_PIN, ECHO_PIN, MAX_DISTANCE);
AF_DCMotor motor1(1, MOTOR12_1KHZ);
AF_DCMotor motor2(2, MOTOR12_1KHZ);
AF_DCMotor motor3(3, MOTOR34_1KHZ);
AF_DCMotor motor4(4, MOTOR34_1KHZ);
Servo myservo;
boolean goesForward=false;
int distance = 100;
int speedSet = 0;
void setup() {
myservo.attach(10);
myservo.write(115);
delay(2000);
distance = readPing();
delay(100);
distance = readPing();
delay(100);
distance = readPing();
delay(100);
distance = readPing();
delay(100);
}
void loop() {
int distanceR = 0;
int distanceL = 0;
delay(40);
if(distance=distanceL)
{
turnRight();
moveStop();
}else
{
turnLeft();
moveStop();
}
}else
{
moveForward();
}
distance = readPing();
}
int lookRight()
{
myservo.write(50);
delay(500);
int distance = readPing();
delay(100);
myservo.write(115);
return distance;
}
int lookLeft()
{
myservo.write(170);
delay(500);
int distance = readPing();
delay(100);
myservo.write(115);
return distance;
delay(100);
}
int readPing() {
delay(70);
int cm = sonar.ping_cm();
if(cm==0)
{
cm = 250;
}
return cm;
}
void moveStop() {
motor1.run(RELEASE);
motor2.run(RELEASE);
motor3.run(RELEASE);
motor4.run(RELEASE);
}
void moveForward() {
if(!goesForward)
{
goesForward=true;
motor1.run(FORWARD);
motor2.run(FORWARD);
motor3.run(FORWARD);
motor4.run(FORWARD);
for (speedSet = 0; speedSet < MAX_SPEED; speedSet +=2) // slowly bring the speed up to avoid loading down the batteries too quickly
{
motor1.setSpeed(speedSet);
motor2.setSpeed(speedSet);
motor3.setSpeed(speedSet);
motor4.setSpeed(speedSet);
delay(5);
}
}
}
void moveBackward() {
goesForward=false;
motor1.run(BACKWARD);
motor2.run(BACKWARD);
motor3.run(BACKWARD);
motor4.run(BACKWARD);
for (speedSet = 0; speedSet < MAX_SPEED; speedSet +=2) // slowly bring the speed up to avoid loading down the batteries too quickly
{
motor1.setSpeed(speedSet);
motor2.setSpeed(speedSet);
motor3.setSpeed(speedSet);
motor4.setSpeed(speedSet);
delay(5);
}
}
void turnRight() {
motor1.run(FORWARD);
motor2.run(FORWARD);
motor3.run(BACKWARD);
motor4.run(BACKWARD);
delay(500);
motor1.run(FORWARD);
motor2.run(FORWARD);
motor3.run(FORWARD);
motor4.run(FORWARD);
}
void turnLeft() {
motor1.run(BACKWARD);
motor2.run(BACKWARD);
motor3.run(FORWARD);
motor4.run(FORWARD);
delay(500);
motor1.run(FORWARD);
motor2.run(FORWARD);
motor3.run(FORWARD);
motor4.run(FORWARD);
}
Before uploading the code you have to install the necessary library
//AFMotor Library learn.adafruit.com/adafruit-motor-shield/library-install //
//NewPing Library github.com/livetronic/Arduino-NewPing//
//Servo Library github.com/arduino-libraries/Servo.git //
// To Install the libraries go to sketch >> Include Library >> Add .ZIP File >> Select the Downloaded ZIP files From the Above links //
3.5v 2000mAh two rechargable batteries only needed
How i want to control the servo motor...help me...
th-cam.com/video/Xr873sXm2WI/w-d-xo.html
Chetta code correct ano njn ee project palla site nokki onnum sheri ayilla
My code will work . Link in description
Full cost ethrayaa
2300
What is the code
For Downloading code Link in the video description
What is the rpm of the bo motor
www.amazon.in/dp/B07CVYWYQ7/ref=cm_sw_r_cp_apa_i_4LJvFbDJFB3QW
What is the rpm of the bo motor
Operating voltage : 3v 12v dc
Rpm : approximately 150 rpm
Bro i install all the library but .servo motor was rotate in 360 degree..
//ARDUINO OBSTACLE AVOIDING CAR//
#include
#include
#include
#define TRIG_PIN A0
#define ECHO_PIN A1
#define MAX_DISTANCE 200
#define MAX_SPEED 190 // sets speed of DC motors
#define MAX_SPEED_OFFSET 20
NewPing sonar(TRIG_PIN, ECHO_PIN, MAX_DISTANCE);
AF_DCMotor motor1(1, MOTOR12_1KHZ);
AF_DCMotor motor2(2, MOTOR12_1KHZ);
AF_DCMotor motor3(3, MOTOR34_1KHZ);
AF_DCMotor motor4(4, MOTOR34_1KHZ);
Servo myservo;
boolean goesForward=false;
int distance = 100;
int speedSet = 0;
void setup() {
myservo.attach(10);
myservo.write(115);
delay(2000);
distance = readPing();
delay(100);
distance = readPing();
delay(100);
distance = readPing();
delay(100);
distance = readPing();
delay(100);
}
void loop() {
int distanceR = 0;
int distanceL = 0;
delay(40);
if(distance=distanceL)
{
turnRight();
moveStop();
}else
{
turnLeft();
moveStop();
}
}else
{
moveForward();
}
distance = readPing();
}
int lookRight()
{
myservo.write(50);
delay(500);
int distance = readPing();
delay(100);
myservo.write(115);
return distance;
}
int lookLeft()
{
myservo.write(170);
delay(500);
int distance = readPing();
delay(100);
myservo.write(115);
return distance;
delay(100);
}
int readPing() {
delay(70);
int cm = sonar.ping_cm();
if(cm==0)
{
cm = 250;
}
return cm;
}
void moveStop() {
motor1.run(RELEASE);
motor2.run(RELEASE);
motor3.run(RELEASE);
motor4.run(RELEASE);
}
void moveForward() {
if(!goesForward)
{
goesForward=true;
motor1.run(FORWARD);
motor2.run(FORWARD);
motor3.run(FORWARD);
motor4.run(FORWARD);
for (speedSet = 0; speedSet < MAX_SPEED; speedSet +=2) // slowly bring the speed up to avoid loading down the batteries too quickly
{
motor1.setSpeed(speedSet);
motor2.setSpeed(speedSet);
motor3.setSpeed(speedSet);
motor4.setSpeed(speedSet);
delay(5);
}
}
}
void moveBackward() {
goesForward=false;
motor1.run(BACKWARD);
motor2.run(BACKWARD);
motor3.run(BACKWARD);
motor4.run(BACKWARD);
for (speedSet = 0; speedSet < MAX_SPEED; speedSet +=2) // slowly bring the speed up to avoid loading down the batteries too quickly
{
motor1.setSpeed(speedSet);
motor2.setSpeed(speedSet);
motor3.setSpeed(speedSet);
motor4.setSpeed(speedSet);
delay(5);
}
}
void turnRight() {
motor1.run(FORWARD);
motor2.run(FORWARD);
motor3.run(BACKWARD);
motor4.run(BACKWARD);
delay(500);
motor1.run(FORWARD);
motor2.run(FORWARD);
motor3.run(FORWARD);
motor4.run(FORWARD);
}
void turnLeft() {
motor1.run(BACKWARD);
motor2.run(BACKWARD);
motor3.run(FORWARD);
motor4.run(FORWARD);
delay(500);
motor1.run(FORWARD);
motor2.run(FORWARD);
motor3.run(FORWARD);
motor4.run(FORWARD);
}
Add this code
Tq bro
Chetta Mobile yill upload cheyunna oru video cheyyuvoo plzz full support
I have uploaded already See this video : th-cam.com/video/Mw589orCT3c/w-d-xo.html
ChettA whatsApp no onnu tharamoo?
സംശയങ്ങൾ ഒക്കെ ഇവിടെ ചോദിച്ചോളൂ
Bro library install ചെയ്യാന് പറ്റുന്നില്ല.
??
// Before uploading the code you have to install the necessary library//
//AFMotor Library learn.adafruit.com/adafruit-motor-shield/library-install //
//NewPing Library github.com/livetronic/Arduino-NewPing//
//Servo Library github.com/arduino-libraries/Servo.git //
// To Install the libraries go to sketch >> Include Library >> Add .ZIP File >> Select the Downloaded ZIP files From the Above links
@@GLENTECH ath install cheythu
But newping master install cheyyumbol properties file not found eannnn kaanikkunnnu
No bro what is the rpm of the motor
Speed of the motor bro
Operating voltage : 3v 12v dc
Rpm : approximately 150 rpm
Sir aurdino amazon link taramo itu available alla
No bro what is the accurate of the rpm of motor
hello. what if i don't have a pin header connector? how do i make it work?
i hope u can answer this, i hope u can help becasue this is for school purposes
Just solder the wires to that port .
@@GLENTECH thank u for responding! but how do i solder it? do i solder it from the below of the motor shield and not from the top??
@@juan-dk7qe solder it from below the board . See the diagram .
@@GLENTECH oh okay thank u so much! btw last question, is it required for it to have a switch? or it can work without the switch?
Do you know kariku
Chetta ഈ റോബോട് കാറിനെ ഒന്ന് modify ചെയ്തു WALL - E robot നെ നിർമിക്കുന്ന ഒരു വീഡിയോ ചെയ്യാമോ, please.
I will try
@@GLENTECH Thanks
@@GLENTECH I will support your channel 👍👍
What is the total budget of this robot car. Plz reply
Below 4000
We can use 2100mah battery
Yes , use 2 batteries
Pls give new code link
Link in description
drive.google.com/file/d/1Sjspsz2em8Thq_8WhalYu_YcsMar9z60/view
Open this link and download it
This link not working
When the link open you will see a download button click on that and the files will start to download
They say there was a problem in preview cant downlod the link
Hi Glen tech I have a doubt what should we do with the libraries
//AFMotor Library learn.adafruit.com/adafruit-motor-shield/library-install //
//NewPing Library github.com/livetronic/Arduino-NewPing//
//Servo Library github.com/arduino-libraries/Servo.git //
// To Install the libraries go to sketch >> Include Library >> Add .ZIP File >> Select the Downloaded ZIP files From the Above links //
In the Arduino IDE, navigate to Sketch > Include Library > Add .ZIP Library. At the top of the drop down list, select the option to "Add .ZIP Library''.
But I want to code in laptop
Your videos are amazing
Please reply
Can i use 12v battery
Yes
Can u give the parts list
It's already given in video discription .
Bro circuit diagram
Download this file : drive.google.com/file/d/1Sjspsz2em8Thq_8WhalYu_YcsMar9z60/view
It includes the code , files and diagram
I were inserted code into Arduino ..howcan i delete that and reset my board..
No need to reset , you just insert new code
//ARDUINO OBSTACLE AVOIDING CAR//
// Before uploading the code you have to install the necessary library//
//AFMotor Library learn.adafruit.com/adafruit-motor-shield/library-install //
//NewPing Library github.com/livetronic/Arduino-NewPing//
//Servo Library github.com/arduino-libraries/Servo.git //
// To Install the libraries go to sketch >> Include Library >> Add .ZIP File >> Select the Downloaded ZIP files From the Above links //
#include
#include
#include
#define TRIG_PIN A0
#define ECHO_PIN A1
#define MAX_DISTANCE 200
#define MAX_SPEED 190 // sets speed of DC motors
#define MAX_SPEED_OFFSET 20
NewPing sonar(TRIG_PIN, ECHO_PIN, MAX_DISTANCE);
AF_DCMotor motor1(1, MOTOR12_1KHZ);
AF_DCMotor motor2(2, MOTOR12_1KHZ);
AF_DCMotor motor3(3, MOTOR34_1KHZ);
AF_DCMotor motor4(4, MOTOR34_1KHZ);
Servo myservo;
boolean goesForward=false;
int distance = 100;
int speedSet = 0;
void setup() {
myservo.attach(10);
myservo.write(115);
delay(2000);
distance = readPing();
delay(100);
distance = readPing();
delay(100);
distance = readPing();
delay(100);
distance = readPing();
delay(100);
}
void loop() {
int distanceR = 0;
int distanceL = 0;
delay(40);
if(distance=distanceL)
{
turnRight();
moveStop();
}else
{
turnLeft();
moveStop();
}
}else
{
moveForward();
}
distance = readPing();
}
int lookRight()
{
myservo.write(50);
delay(500);
int distance = readPing();
delay(100);
myservo.write(115);
return distance;
}
int lookLeft()
{
myservo.write(170);
delay(500);
int distance = readPing();
delay(100);
myservo.write(115);
return distance;
delay(100);
}
int readPing() {
delay(70);
int cm = sonar.ping_cm();
if(cm==0)
{
cm = 250;
}
return cm;
}
void moveStop() {
motor1.run(RELEASE);
motor2.run(RELEASE);
motor3.run(RELEASE);
motor4.run(RELEASE);
}
void moveForward() {
if(!goesForward)
{
goesForward=true;
motor1.run(FORWARD);
motor2.run(FORWARD);
motor3.run(FORWARD);
motor4.run(FORWARD);
for (speedSet = 0; speedSet < MAX_SPEED; speedSet +=2) // slowly bring the speed up to avoid loading down the batteries too quickly
{
motor1.setSpeed(speedSet);
motor2.setSpeed(speedSet);
motor3.setSpeed(speedSet);
motor4.setSpeed(speedSet);
delay(5);
}
}
}
void moveBackward() {
goesForward=false;
motor1.run(BACKWARD);
motor2.run(BACKWARD);
motor3.run(BACKWARD);
motor4.run(BACKWARD);
for (speedSet = 0; speedSet < MAX_SPEED; speedSet +=2) // slowly bring the speed up to avoid loading down the batteries too quickly
{
motor1.setSpeed(speedSet);
motor2.setSpeed(speedSet);
motor3.setSpeed(speedSet);
motor4.setSpeed(speedSet);
delay(5);
}
}
void turnRight() {
motor1.run(FORWARD);
motor2.run(FORWARD);
motor3.run(BACKWARD);
motor4.run(BACKWARD);
delay(500);
motor1.run(FORWARD);
motor2.run(FORWARD);
motor3.run(FORWARD);
motor4.run(FORWARD);
}
void turnLeft() {
motor1.run(BACKWARD);
motor2.run(BACKWARD);
motor3.run(FORWARD);
motor4.run(FORWARD);
delay(500);
motor1.run(FORWARD);
motor2.run(FORWARD);
motor3.run(FORWARD);
motor4.run(FORWARD);
}
// Before uploading the code you have to install the necessary library//
//AFMotor Library learn.adafruit.com/adafruit-motor-shield/library-install //
//NewPing Library github.com/livetronic/Arduino-NewPing//
//Servo Library github.com/arduino-libraries/Servo.git //
// To Install the libraries go to sketch >> Include Library >> Add .ZIP File >> Select the Downloaded ZIP files From the Above links //
Can i get your facebook
Instagram link in video description
And also i cant get install the af motor library.
Before uploading the code you have to install the necessary library//
//AFMotor Library learn.adafruit.com/adafruit-motor-shield/library-install //
//NewPing Library github.com/livetronic/Arduino-NewPing//
//Servo Library github.com/arduino-libraries/Servo.git //
Download this 3 files and open documents , Arduino folder , library folder and paste 3 files in it
Bro accurate of the rpm of the gear motor
The BO motor has an operating voltage of 3V - 12V DC.
This BO motor runs at a speed of approximately 150RPM.
If you give 12v , it will work with rpm of 150
Thanks bro
Pwoli
Thankyou dear friend for your valuable comment and support 🙂
Bro how to download code....pls tell me
For Downloading link in video description
But bro it tell me having an error .....at NewPing sonar (TRIG_PIN,ECHO_PIN,MAX_DISTANCE);
// Before uploading the code you have to install the necessary library//
//AFMotor Library learn.adafruit.com/adafruit-motor-shield/library-install //
//NewPing Library github.com/livetronic/Arduino-NewPing//
//Servo Library github.com/arduino-libraries/Servo.git //
// To Install the libraries go to sketch >> Include Library >> Add .ZIP File >> Select the Downloaded ZIP files From the Above links //
Code batao to bro in weels
Bro I got it in RAR file bro
Open (Extra) that folder using RAR software
www.win-rar.com/start.html?&L=0
Bro it shows new ping no such file or directory
When you extra the RAR file you will get 4 folders from that copy AFMotor , NewPing , servo folder and open my documents then open Arduino folder then open library and paste this three folders .