Welcome to Building:bit Superkit repository
5.Drive 180° servo
Drive 180° servo
Drive 180° servo1. Learning objectives2. Servo wiring3. Programming3.1 Add expansion package3.2 Building blocks used3.3 Combining blocks4. Experimental phenomenon
1. Learning objectives
In this course, we mainly learn how to drive the servo connected to the superbit expansion board through MakeCode graphical programming.
The servo interface is located on the expansion board as shown in the figure below.
2. Servo wiring
Insert the servo wiring into the S1 interface of the Super:bit expansion board, and insert the orange servo wiring into the yellow pin of S1, as shown in the figure below.
3. Programming
Method 1 Online programming:
First, connect the micro:bit to the computer via a USB data cable. The computer will pop up a U disk. Click the URL in the U disk: https://makecode.microbit.org/ to enter the programming interface. Then, add the Yahboom smart software package https://github.com/YahboomTechnology/SuperBitLibV2 to start programming.
Method 2 Offline programming:
Open the offline programming software MakeCode and enter the programming interface. Click [New] and add the Yahboom smart software package https://github.com/YahboomTechnology/SuperBitLibV2 to start programming.
3.1 Add expansion package
3.2 Building blocks used
The location of the building blocks required for this programming is shown in the figure below.
3.3 Combining blocks
The summary program is shown in the figure below.
You can also directly open the microbit-Servo180Driver.hex file provided in this experiment and drag it into the browser that opens the URL, and the program diagram of this project source code will be automatically opened
4. Experimental phenomenon
After the program is successfully downloaded, the micro:bit dot matrix will display a heart pattern, as shown in the figure below. Then we can see that the servo starts to rotate, 0°->90°->180°->90°, with a time interval of 1 second.
If you need to restart, please press the reset button on the back of the micro:bit motherboard.