Welcome to Building:bit Superkit repository
4.Drive 270°building block servo
Drive 270°building block servo
Drive 270°building block servo1. Learning Objectives2. Servo Wiring3. Programming3.1 Add expansion package3.2 Building blocks used3.3 Combined blocks4. Experimental phenomenon
1. Learning Objectives
In this course, we mainly learn how to drive the brick 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 brick 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 Combined blocks
The summary program is shown in the figure below.
You can also directly open the microbit-Servo270Driver.hex file provided in this experiment and drag it into the browser that opens the URL, and the program diagram of the source code of this project 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. At the beginning of the program, the servo is initialized to 0°, and then we can see that the servo starts to rotate, 0°->90°->180°->270°->180°->90°->0°, 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.