Use a servo in python and PXT.
The Tower Pro SG90 is a small, 9 gram servo that can run directly from the microbit power supply. This is a 180° servo meaning it can turn from 0° to 180°. It has many applications: open a flap to dispense treats for to a dog, create a robotic walker, or to drive window wipers on a car.
Most servos have three wires: GND, POWER, and SIGNAL.
Wire colours differ based on manufacturer. Here’s the Tower Pro servo; look at the wire colours:
Information about the wire colours can be found in the datasheet. This can be found by Googling SG90 datasheet:
We now know how to connect the servo:
|Servo Wire Colour||Data Sheet Label||Connect to Microbit Pin|
The angle of the servo is set by a PWM pulse to the orange wire. This is connected to
Servos are difficult to control in Python on the microbit. I’ve tried to make it easy below.
Published: December 23, 2016 Updated: December 23, 2016
Acknowledgements: Servo teaser & diagram by [Upgrade Industries](https://www.upgradeindustries.com/licensing/)