Controling servo motors with buttons and arduino

Hello there, in my first project I will show how to control a servo motor with two buttons using arduino UNO.

Jan 16, 2021

41139 views

2 respects

Components and supplies

2

Resistor 10k ohm

1

Breadboard (generic)

2

Pushbutton switch 12mm

1

Arduino UNO

8

Jumper wires (generic)

1

SG90 Micro-servo motor

Apps and platforms

1

Arduino IDE

Project description

Code

Project code:

c_cpp

I used arduino IDE to do the code

Downloadable files

Circuit diagram

I used TinkerCad to do this diagram

Circuit diagram

Circuit diagram

I used TinkerCad to do this diagram

Circuit diagram

Comments

Only logged in users can leave comments

afiveperc1

13 days ago

cool project, i had to add pos = constrain(pos, 0, 180); to both if statements, otherwise it would behave in a weird way if you held down a button past 180

bruno_opaiva

13 days ago

Hey! That's nice. It was my first project at project hub when I was much more noob haha. Thanks for adding this line, I'll give it a try and probably edit the posted code.

chaspo

10 months ago

nice project, just what i was looking for

bruno_opaiva

4 months ago

Thank you! I am glad to know this project helped you!

bruno_opaiva

4 years ago

I hope you enjoy! Thanks ;-)