Use ultrasonic control servo_smart trash

  Рет қаралды 9

Yu Ping Liao

Yu Ping Liao

Күн бұрын

Use ultrasonic control servo_smart trash can
(採用超音波控制伺服_智慧垃圾桶)
Please like👍 + subscribe to the channel
(請按讚👍+訂閱頻道)
canWiring diagram(接線圖):circuitdigest....

Пікірлер: 1
@yupingliao4078
@yupingliao4078 2 күн бұрын
Please like👍 + subscribe to the channel code👇 /*Use ultrasonic control servo_smart trash can */ #include const int TRIG_PIN = 6; const int ECHO_PIN = 7; const int SERVO_PIN = 9; const int DISTANCE_THRESHOLD = 50; Servo servo; void setup() { Serial.begin (9600); pinMode(TRIG_PIN, OUTPUT); pinMode(ECHO_PIN, INPUT); servo.attach(SERVO_PIN); servo.write(0); } void loop() { digitalWrite(TRIG_PIN, HIGH); delayMicroseconds(10); digitalWrite(TRIG_PIN, LOW); duration_us = pulseIn(ECHO_PIN, HIGH); distance_cm = 0.017 * duration_us; if(distance_cm < DISTANCE_THRESHOLD) servo.write(90); else servo.write(0); Serial.print("distance: "); Serial.print(distance_cm); Serial.println(" cm"); delay(500); }
Forget About Raspberry Pi! Use Your Old Phone Instead.
9:09
Doctor Volt
Рет қаралды 388 М.
Sub-Surface Simon
8:16
alnwlsn
Рет қаралды 135 М.
The selfish The Joker was taught a lesson by Officer Rabbit. #funny #supersiblings
00:12
Funny superhero siblings
Рет қаралды 10 МЛН
Don't look down on anyone#devil  #lilith  #funny  #shorts
00:12
Devil Lilith
Рет қаралды 42 МЛН
Officer Rabbit is so bad. He made Luffy deaf. #funny #supersiblings #comedy
00:18
Funny superhero siblings
Рет қаралды 17 МЛН
🍉😋 #shorts
00:24
Денис Кукояка
Рет қаралды 4 МЛН
Neat Method To Remove PCB Connectors / Desoldering Connectors
15:17
DIY Laser Image Projector (100ft+ Range!)
20:08
Ben Makes Everything
Рет қаралды 349 М.
Bad apple
11:42
鐘森竣
Рет қаралды 5 МЛН
Have you ever seen soldering THIS close?
9:53
Robert Feranec
Рет қаралды 503 М.
This isn't a normal mini PC... and I love it.
14:17
Hardware Haven
Рет қаралды 374 М.
Video to highlight the problem of repairing flat panel TV sets
24:14
Michael Dranfield
Рет қаралды 329 М.
Arduino uses MAX7219 LED 32*8 space race game with joystick
1:38
The selfish The Joker was taught a lesson by Officer Rabbit. #funny #supersiblings
00:12
Funny superhero siblings
Рет қаралды 10 МЛН