Case 74: The Happy Crab
78. Case 74: The Happy Crab#
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.
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.
Build it as the assembly steps suggest:
78.2. 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.
78.3. MakeCode Programming#
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.
The program is displayed below:
You may also download it directly:
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.