View on GitHub

nifty-motor-driver-microbit

MakeCode extension for motor drivers

nifty-motor-driver-microbit

Open this page at https://healthywalk.github.io/nifty-motor-driver-microbit/

Summary

This extension supports the Motor drivers in micro:bit MakeCode programming.
Many motor driver ICs or their breakouts, including Kitronik motor driver board, can use the extension.
Motor command values can be positive or negative (-100..100) and they mean forward or backward.

Methods

Example

NiftyMotorDriver.initializeMotorDriver(MotorEnum.m1, DigitalPin.P8, DigitalPin.P12)
basic.forever(function () {
    NiftyMotorDriver.driveMotor(MotorEnum.m1, 50)
    basic.pause(2000)
    NiftyMotorDriver.coastMotor(MotorEnum.m1)
    basic.pause(2000)
    NiftyMotorDriver.driveMotor(MotorEnum.m1, -50)
    basic.pause(2000)
    NiftyMotorDriver.brakeMotor(MotorEnum.m1)
    basic.pause(2000)
})

Use as Extension

This repository can be added as an extension in MakeCode.

Metadata (used for search, rendering)