Skip to main content

Case 74: The Happy Crab

Introduction

Whenever we think of a crab we think of its horizontal stride and we often see them in funny videos, in this course let's make a happy crab. We will use the RFID sensor as a switch, and when the RFID sensor detects the card, the little crab starts to play happily.

Materials Required

Nezha expansion board × 1

micro:bit V2 × 1

Servos × 2

RFID Sensor × 1

Motors × 2

RJ11 cables × 1

Bricks × n

Note: If you want all of the above components, you may purchase the Nezha 48 IN 1 Inventor's Kit.

Assembly Steps

Components Details

Build it as the assembly steps suggest:

Connection Diagram

We need to connect the Motors to the M1 and M4 port, the Servos to the S1 and S4 port, and the RFID sensor to the IIC port.

MakeCode Programming

Step 1

Click “Advanced” in the MakeCode drawer to see more choices.

We need to add a package for programming. Click “Extensions” at the bottom of the drawer and search with “nezha” to download it.

We need to add a package for programming. Search with “PlanetX” in the dialogue box and click to download it.

Notice: If you met a tip indicating that some codebases would be deleted due to incompatibility, you may continue as the tips say or create a new project in the menu.

Reference

The program is displayed below:

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

You may also download it directly:

Result

When we put the card on the front of the RFID sensor, and the RFID sensor detects the card, the crab will start running sideways and swinging its two pincers in a circular motion.