T ThinkEdge Learn

Servo — Two Buttons, Two Positions

Press A → go to 0°. Press B → go to 180°.

Servo Button If/Else
Arduino servo motor project for students · Tier 2 · Logic & Sensors · Easy · 25 min · Arduino Uno

What you will learn

What you will need

Component
1× 9V battery
1× slide switch
2× pushbuttons
1× servo motor (SG90)
Breadboard
6× jumper wires

Step by step

Take it further

Practise it before you build it

Wire this circuit in the ThinkEdge Learn simulator first. The simulator runs a real Arduino sketch against a modified-nodal-analysis solver, so the LED on screen actually lights when the current is right — no hardware, no burnt components, and a class can try it in a browser.

Open the interactive lab See plans for your class

Related projects

Servo — The Hello World of MotorsSweep back and forth forever Arduino — Servo SweepMake a servo motor wave back and forth Arduino Nano — Reaction Timer GameHow fast can you press the button? Built in a tiny form factor. Arduino Nano — 4-Note Mini PianoFour buttons, four notes, one tiny piano that fits in your pocket Arduino — Two-Player Reaction BattleTwo players, two buttons — fastest finger wins Binary Counter — How Computers CountFour LEDs, sixteen numbers — counting in twos

Guides that use this project

One guide on the site build this project as part of a longer explanation. The guide says why the circuit works; this page says how to wire it.

Robot ArmHow to build a robot arm with hobby servos, a 5 V supply and an Arduino: how to pick joints, wire the power, and test each axis in the simulator.

Where this project sits

It is also part of these lists, which is how a class usually finds it.

Arduino servo motor projects for students12 projects in this list Arduino push button projects for beginners14 projects in this list

Try the full simulator with your class

103 guided circuit projects, 21 lessons and an in-browser Arduino simulator. The first 15 projects are free, no account needed. One licence covers a whole school.