ULTRASONIC SENSOR #include <Servo.h> #define speedPinR 9 // RIGHT WHEEL PWM pin D45 connect front MODEL-X ENA #define RightMotorDirPin1 22 //Front Right Motor direction pin 1 to Front MODEL-X IN1 (K1) #define RightMotorDirPin2 24 //Front Right Motor direction pin 2 to Front MODEL-X IN2 (K1) #define LeftMotorDirPin1 26 //Left front Motor direction pin 1 to Front MODEL-X IN3 ( K3) #define LeftMotorDirPin2 28 //Left front Motor direction pin 2 to Front MODEL-X IN4 ( K3) #define speedPinL 10 // Left WHEEL PWM pin D7 connect front MODEL-X ENB #define speedPinRB 11 // RIGHT WHEEL PWM pin connect Back MODEL-X ENA #define RightMotorDirPin1B 5 //Rear Right Motor direction pin 1 to Back MO...
Ultra Sonic Sensor Code int trigPin = 12; /* Trig pin of the sensor is connected to the 6th pin of Arduino */ int echoPin = 11; /* The echo pin of the sensor is connected to the 7th Pin of the Arduino */ long Duration; //Duration long Distance; //Distance int leftMotor_1=3; //motor 1 the first data entry is HIGH OR LOW int leftMotor_2=2; //motor 1 the second data entry is HIGH OR LOW int rightMotor_1=4; //motor 2 the first data entry is HIGH OR LOW int rightMotor_2=5; //motor 2 the second data entry is HIGH OR LOW int leftMotor_pwm=6; // motor 1 Speed control is done with pwm input for // 0-255 analog PWM signal is sent in range int rightMotor_pwm=9; // motor 2 Speed control is done with pwm input for // 0-255 analog PWM signal is sent in range void setup() { for(in...
Comments
Post a Comment