"It’s Here! The BFCM Sale of the Year – Grab Your Favorites!"

Motorcycle-MakeCode – Micro:bit

microbit makecode

Materials

micro:bit x 1

Wukong expansion board x 1

Motor x 1

Bricks x N

Hardware Connections

Insert the micro:bit to Wukong expansion and connect the motors to M1 and M2 ports accordingly.

Bricks Build-up

Build the bricks as the picture shows:

microbit makecode

microbit makecode

microbit makecode

microbit makecode

microbit makecode

microbit makecode

Software programming

Go to the MakeCode coding page:(https://makecode.microbit.org/#editor) Add wukong extension package, and click extension in the menu of settings on the right upper side.

microbit makecode

Search with“wukong” to download it.

microbit makecode

Now let us go to the coding page: Drag shows icon brick into on start.

microbit makecode

Controlling the turning direction through buttons A and B. While button A is pressed, set the speed of M1 at 0, and M2 at -100, thus making the car turn right; Then use the same way to code the car to turn left.

microbit makecode

While button A&B is being pressed, set the speed of M1 at 100 and M2 at -100.

microbit makecode

While the screen facing to the ground, set the speed of M1&M2 at 0.

microbit makecode

Complete program:

microbit makecode

Link:https://makecode.microbit.org/_f2pbixKaTW6g

Result

Press button A to turn the car left and button B to turn the car right; press both A&B to drive the car forward; While the screen faces the ground, the car stops moving.

Leave a Reply

images
In March, ELECFREAKS supported 5 schools to carry out school science and technology festival activities
images
Children’s Programming Education is the Future Trend
images
Technical verification! Nezha series products can complete WRO competition tasks
images
Let's take part in the Ceremony of the New Factory of ELECFREAKS together!
images
Bluetooth Bee(HC-05 and HC-06) User Guide
images
In March, ELECFREAKS supported 5 schools to carry out school science and technology festival activities
Monthly Archive