Welcome to Building:bit Superkit repository
2.Button control platform
Button control platform
Button control platform1. Learning objectives2. Building blocks3. Motor wiring4. Code analysis5. Write and download the program6. Experimental phenomenon
1. Learning objectives
In this course, we mainly learn how to use Python programming to achieve that when the A button on the micro:bit motherboard is pressed, the lifting platform rises; when the B button on the micro:bit motherboard is pressed, the lifting platform descends.
2. Building blocks
For detailed steps of building blocks, please refer to the installation drawings of [Assembly course]-[Lifting platform] in the materials or the building blocks installation album.
3. Motor wiring
The building block servo wiring is inserted into the S1 interface of the Super:bit expansion board, and the orange servo wiring is inserted into the yellow pin of S1.
As shown in the figure below:

! Notes:
When taking a course related to building block servos for the first time, we need to remove the gears on the servos and upload the program of this course to the micro:bit; then turn on the power switch of the Super:bit expansion board and wait for the building block servos to turn to the initial position; then, we can turn off the power, adjust the lifting platform to the lowest position, as shown in the figure below, and then install the servo gear. (If you have used the lifting platform and servo-related programs before, you can skip this step)

4. Code analysis
For the program of this course, please see the Button control platform.py file.
from microbit import *import superbitFirst, import the libraries needed for this lesson from microbit: the superbit library is compatible with the superbit expansion board;
xxxxxxxxxxdisplay.show(Image.HAPPY)superbit.servo270(superbit.S1, 90)display.show(Image.HAPPY): Display a smiley face pattern on the microbit dot matrix;
superbit.servo270(superbit.S1, 90): Initialize the building block servo to rotate to about 90°;
xxxxxxxxxx