Circuit DIagram: Code: // Before uploading the code you have to install the necessary library// // AFMotor Library https://learn.adafruit.com/adafruit-motor-shield/library-install // // NewPing Library https://github.com/livetronic/Arduino-NewPing// // Servo Library https://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 <AFMotor.h> #include <NewPing.h> #include <Servo.h> #define TRIG_PIN A0 #define ECHO_PIN A1 #define MAX_DISTANCE 200 #define MAX_SPEED 190 #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 spee...