Approved content

The content below is provided by a partner.

elecfreaks/pxt-nezha2 1.2.0 GitHub

NeZha V2 Expansion Pack

NeZha V2 Expansion Board

The NeZha V2 Expansion Pack is tailored for the micro:bit, aimed at stimulating students’ innovative thinking and practical skills. This guide facilitates programming and control of the NeZha V2 Expansion Board, enabling functions such as motor control and sensor integration. To purchase the NeZha V2, visit the Elecfreaks Official Store.

Key Features

Getting Started

Installing the Extension

  1. Launch MakeCode editor and click the “Extensions” icon.
  2. Search for “NeZha V2” or paste the link “https://github.com/elecfreaks/pxt-nezha2" to download and install the extension.

Basic Examples

Motor Rotation Control

Block Editor Example

  1. Drag the “on button A pressed” block into the script area.
  2. Below it, insert the “NeZha V2 - Start Motor” block, set to Motor M1 rotating clockwise.
  3. Repeat for Button B, controlling other motors as desired.

JavaScript Example

input.onButtonPressed(Button.A, function () {
    NEZHA_V2.nezha2MotorStart(MotorPosition.M1, MovementDirection.CW);
});
// Example code omitted; add logic here for Button B controlling different motors

Moving Motor to a Specified Position

Block Editor Example

  1. Utilize the “on button B pressed” block.
  2. Append the “NeZha V2 - Go To Absolute Position” block, specifying Motor M1 to rotate clockwise to position 0.

JavaScript Example

input.onButtonPressed(Button.B, function () {
    NEZHA_V2.goToAbsolutePosition(MotorPosition.M1, ServoMotionMode.CW, 0);
});

Advanced Applications

Delve into advanced functionalities like motor speed regulation and sensor data retrieval. For detailed examples and instructions, visit our online tutorials.

Supported Targets

License

This extension is licensed under the MIT License.

nezha2=github:elecfreaks/pxt-nezha2#v1.2.0