Introduction
Connect a 270˚ Servo to a Bit Board and control it with code.
We'll explore how to control a servo motor.
Video Overview
Featured Document
-
-
The 270 Degree Servo Motor has a 3-wire connector on the end that can plug directly into the pins on the back of the Bit Board.
-
Make sure the Orange Wire is closest to the number 13 for the Pin 13 column.
-
Then the Brown Wire should be closest to the micro:bit (in the - row) and the Red Wire will be in the middle (the +5v row).
-
-
-
If you've never used a micro:bit before you'll want to check out this guide: Bit Board V2 Setup and Use
-
We're going to load the following code for our Servo Random program: https://makecode.microbit.org/_DakToe3Ep...
-
You should know by now we always like to give an example using random numbers!
-
We're generating a random number between 0 and 180 and then setting the servo to that angle.
-
A pause after each move of 50 milliseconds is just enough to get a "jittering" effect, but we could use a higher value if we wanted a bit more pause between moves.
-
For a bit more fun we could even use random values for our pause statement!
-
-
-
Once the code is loaded it should start running immediately.
-
You can power the micro:bit via the USB cable you used to load the code, but now that we are using servos we recommend using a battery pack plugged into the Bit Board.
-
The Blue Pins on the Bit Board provide extra power (5 volts instead of 3 volts) by boosting the voltage coming from the battery pack. This helps improve servo performance, especially with multiple servos.
-
The servo will just start to jitter and jump around!
-
This could be a useful effect for certain projects, and of course you can alter the variables and expand on this for even more jittery servo fun.
-
-
-
Follow along with our recorded Live Stream!
-
You can watch the full video of us walking through this project, along with explaining and exploring the code: https://youtube.com/live/T8jrPuhOp_g
-
