12. Nezha Expansion Board¶
Nezha is an expanstion board for micro:bit with multuple functions available. It equips with four servos connections, four motors connections and seven sensors connections. All of the connections are required with RJ11 connectors that are fool-proofing and easy to plug. It is also compatible to Lego and Fischertechnik bricks and is available to get them connected with the electric modules, thus it allows students to easily create their own amazing micro:bit projects.
RJ11 connections, easy to plug.
12.4. Outlook and Dimensions¶
12.5. Main Parts Introduction¶
12.6. Add Package¶
Click “Advanced” in the MakeCode drawer to see more choices.
We need to add a package for programming. Click “Extensions” in the bottom of the drawer and search with “nezha” in the dialogue box to download it.
Note: If you met a tip indicating that the codebase will be deleted due to incompatibility, you may continue as the tips say or build a new project in the menu.
12.7. Ways of Operation¶
Code as below:¶
Code as below:¶
12.8. Python Programming¶
Download the package and unzip it: PlanetX_MicroPython
Go to Python editor
We need to add nezha.py for programming. Click “Load/Save” and then click “Show Files (1)” to see more choices, click “Add file” to add nezha.py from the unzipped package of PlanetX_MicroPython.
from microbit import * from nezha import * nezha = NEZHA() nezha.set_motors(1, 100) while True: nezha.set_servo(1, 90) sleep(1000) nezha.set_servo(1, 0) sleep(1000)
The motor connecting to M1 drives at the speed of 100%; The servo connecting to S1 drives to 90° and pause one second, then it drives to 0° and pause another second, and it continuously drives in this pace.