Automatic trash can

Hello, I need help on my project. I use arduino nano, servo motor and ultrasonic sensor. So my objective right now is to make the servo motor move 180 degree triggered by the ultrasonic sensor. Can anyone help me on the coding and the breadboard connection? Thanks T_T

What have you tried?

Post your program and tell us what it actually does and what you want it to do that is different.

Have you written short separate programs to learn how to control a servo and get data from your ultrasonic sensor?

If you want someone to write a program for you please ask in the Gigs and Collaborations section of the Forum and be prepared to pay.

...R

thankyou sir

Hi I am newbie into this arduino thingy. Can anyone teach me how to change the angle and speed of the servo motor in this coding.

autotrashcan_ino.ino (933 Bytes)

autotrashcan_ino.ino (933 Bytes)

autotrashcan_ino.ino (933 Bytes)

The servo.write(angle) or servo.writeMicroseconds() functions tell the servo the absolute position to move the servo to. See the Servo library reference. The servo will move, at full speed, from the current position to the commanded position. If you want to slow the servo movement, you move it in small steps with a delay between steps. Google "arduino adjust servo speed" for ways to do that.

Please read the "how to use the forum-please read" stickies to see how to post the code so that people don't have to download it.

FarhanHelmy:
thankyou sir

That is not an answer to my questions :slight_smile:

And don't double post. I have suggested to the Moderator to merge your other Thread with this one

...R

There's a library VarSpeedServo.h that allows setting the speed at which the servo moves. Other than that it's very similar to the standard Servo.h.

Steve