Skip to main content

Posts

Showing posts from September, 2020

Obstacle Avoiding Car With Ultrasonic Sensor|Autonomous Car Using L293D Motor Driver|Topped With Fun

Download The Libraries Here:- Motor-Shield-l-master Arduino-NewPing-master Circuit Diagram:- Code:- #include <AFMotor.h>   #include <NewPing.h> #include <Servo.h>  #define TRIG_PIN A4  #define ECHO_PIN A5 #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; ...