YFROBOT MotorBit extension for makecode
MotorBit is an easy-to-use motor drive expansion board for MicroBit
The YFROBOT Motor:Bit is an integrated motor driver and breakout board for the BBC micro:bit. With two integrated motor driver chip DRV8838, your micro:bit can drive two DC motors with 250mA max single channel current.
The Motor:Bit also features the “GVS” connectors, allowing for easy direct connection to compatible “GVS” sensors and outputs. Among these connectors, P0, P1 support sensors with 3.3V power voltage only; P2, P8, support 3.3V or 5V sensors, You can change the output voltage by jumper caps on the board.
- Set the direction and speed of MotorBit motor
motorbit.motorRun(motorbit.Motors.ML, motorbit.Dir.CW, 120)
motorbit.motorRun(motorbit.Motors.MR, motorbit.Dir.CCW, 120)
- Stop the MotorBit motor
motorbit.motorStop(motorbit.Motors.ML)
- Move forward
motorbit.forward(128)
- Move back
motorbit.back(128)
- Turn left
motorbit.turnLeft(128)
- Turn right
motorbit.turnRight(128)
- Read IR sensor value
basic.showNumber(motorbit.irButtonCode())
MIT
Copyright (c) 2020, YFROBOT
- for PXT/microbit (The metadata above is needed for package search.)