How to combine an Servo and Ultrasonic Sensor and code
This video was created to help people create a Servo and Ultrasonic Sensor
Other Youtube channel Andre ClassicCuts
https://www.youtube.com/channel/UC7CU4ydXEDfnaYhj6ToAjTg
DreThePlug IG: DreThePlug123
https://www.instagram.com/dretheplug123/
Add me on Linkedin
https://www.linkedin.com/in/andre-brown-194918103/
How to Control the Ultra Sonic Sensor Ranges with Sound/Music Arduino
https://youtu.be/4I6jkPBma4M
Music provided by isthatCaydo?.
Instrumental: Reprod. by Caydo
Channel: https://www.youtube.com/watch?v=-l92PxYmRa0
Note servo wires colors
Brown-GND
Red-VCC
Orange-PWM aka Signal
The Treasure Chest
int trigPin = 3;
int echoPin = 2;
#include (less than sign)Servo.h(greater than sign)
Servo servo1;
Servo servo2;
int angle = 0;
void setup() {
Serial.begin(9600);
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT); // put your setup code here, to run once:
servo1.attach(4);
servo1.write(angle);
servo2.attach(12);
servo2.write(angle);
}
void loop() {
long duration, distance;
digitalWrite(trigPin,HIGH);
delayMicroseconds(1000);
digitalWrite(trigPin, LOW);
duration=pulseIn(echoPin, HIGH);
distance =(duration/2)/29.1;
Serial.print(distance);
Serial.println("CM");
delay(10);
if (distance (less than sign) 30) {
servo1.write(90);
servo2.write(0);
}
else {
servo1.write(0);
servo2.write(90);
}
}
Видео How to combine an Servo and Ultrasonic Sensor and code канала DreThePlug
Other Youtube channel Andre ClassicCuts
https://www.youtube.com/channel/UC7CU4ydXEDfnaYhj6ToAjTg
DreThePlug IG: DreThePlug123
https://www.instagram.com/dretheplug123/
Add me on Linkedin
https://www.linkedin.com/in/andre-brown-194918103/
How to Control the Ultra Sonic Sensor Ranges with Sound/Music Arduino
https://youtu.be/4I6jkPBma4M
Music provided by isthatCaydo?.
Instrumental: Reprod. by Caydo
Channel: https://www.youtube.com/watch?v=-l92PxYmRa0
Note servo wires colors
Brown-GND
Red-VCC
Orange-PWM aka Signal
The Treasure Chest
int trigPin = 3;
int echoPin = 2;
#include (less than sign)Servo.h(greater than sign)
Servo servo1;
Servo servo2;
int angle = 0;
void setup() {
Serial.begin(9600);
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT); // put your setup code here, to run once:
servo1.attach(4);
servo1.write(angle);
servo2.attach(12);
servo2.write(angle);
}
void loop() {
long duration, distance;
digitalWrite(trigPin,HIGH);
delayMicroseconds(1000);
digitalWrite(trigPin, LOW);
duration=pulseIn(echoPin, HIGH);
distance =(duration/2)/29.1;
Serial.print(distance);
Serial.println("CM");
delay(10);
if (distance (less than sign) 30) {
servo1.write(90);
servo2.write(0);
}
else {
servo1.write(0);
servo2.write(90);
}
}
Видео How to combine an Servo and Ultrasonic Sensor and code канала DreThePlug
Показать
Комментарии отсутствуют
Информация о видео
Другие видео канала
Autonomous Vehicle Engineer Computer EngineerInternational Space University / Space Inspiration and Life On Mars YT: Like An AstronautHow I Became a Software Engineer Without a Computer Science DegreeBusiness Supply Chain Management / General Motors and PepsicoDetroit Auto Show 2022, Lincolns Concept EV, Electric Challenger, Buick Wildcat Concept CarUltra Sonic Sensor with Sound Music ArduinoBasic Project: How to make a LED blink with a Arduino or Raspberry piYale University Phd EngineeringStationary Air Condition Engineer (HVAC) for Commercial PropertyCircuit Power and Ground Real Life ExamplesDay In Life Research and Development Engineer 20232023 Best Gourmia Air FryerDow Chemical Computer Engineer for Phones Testing / Vending Machine BusinessTop Massage Gun 2023 Theragun Prime Massage GunYouTube theme and residual views (Part 4)Portable Neck Air Conditionerhow to control the flow and direction of LEDs with Arduino or Raspberry piFreshmen and Senior Student Loans TipsMechanical Engineer for Boeing Part 2North Carolina Computer Science DegreeWeb Developer Career 2023