Welcome to Building:bit Superkit repository
1.Clumsy reptile
Clumsy reptile
Clumsy reptile1. 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 make the creeper car move forward and backward.
Walking principle of creeper car:
The friction of the front wheel is changed by adjusting the 1# bolt connection buckle ratchet to control the forward direction of the car. When the 1# bolt connection is located in front of the 24-tooth gear, the front wheel can only move forward, so the car creeps forward; when the 1# bolt is connected to the back of the 24-tooth gear, the front wheel can only move backward, and the car creeps backward.
2. Building blocks
For the steps of building blocks, please refer to the installation drawings of [Assembly course]-[Unicycle] in the materials or the building block installation album.
After assembly, the frame of the creeper car needs to be adjusted to the closed state.

! Special Notes:
Place the two ratchets in front of the 24-tooth gear so that the crawler can move forward.
Place the two ratchets behind the 24-tooth gear so that the crawler can move backward.
**
3. Motor Wiring
Insert the motor wiring on the left side of the car into the M1 interface of the Super:bit expansion board, with the black wire close to the battery side;
As shown below:

4. Code Analysis
For the program of this course, please see the Clumsy reptile.py file.
from microbit import *import superbitimport microbitFirst, import the library needed for this lesson from microbit: the superbit library is dedicated to the superbit expansion board.
xxxxxxxxxxdisplay.show(Image.HAPPY)display.show(Image.HAPPY): Display a smiley face pattern on the microbit dot matrix;
xxxxxxxxxxwhile True:superbit.motor_control(superbit.M1, -255, 0)microbit.sleep(2000)superbit.motor_control(superbit.M1, 255, 0)microbit.sleep(2000)while True: infinite loop
superbit.motor_control(superbit.M1, -255, 0): The motor of the M1 interface reverses at a speed of 255, and the crawler frame opens;
microbit.sleep(2000): Delay
superbit.motor_control(superbit.M1, 255, 0): The motor of the M1 interface rotates forward at a speed of 255, and the creeper frame is closed;
microbit.sleep(2000): Delay
5. Write and download the program
- Open the Mu software and enter the code in the editing window. Note! All English and symbols should be entered in English mode, use the Tab key (tab key) for indentation, and the last line ends with a blank program.
- Click the thumb 'Check' button to check whether our code has errors. If a cursor or underline appears in a line, it means a syntax error. Please check and modify it. If there is no error, the