The MakerBit connects to the BBC micro:bit or Calliope Mini with Callio:bit M to provide easy connections to a wide variety of sensors, actuators and other components. This is a package for Microsoft Makecode.
MakerBit | MakerBit+R with motor controller |
Attach an external HC-SR04 ultrasonic distance sensor to steer your robots.
Measures the distance and returns the result in a range from 1 to 300 centimeters or up to 118 inch. The maximum value is returned to indicate when no object was detected.
makerbit.getUltrasonicDistance(DistanceUnit.CM, MakerBitPin.P5, MakerBitPin.P8)
let distance = 0
basic.forever(() => {
distance = makerbit.getUltrasonicDistance(DistanceUnit.CM, MakerBitPin.P5, MakerBitPin.P8)
led.plotBarGraph(distance, 0)
})
Use an I2C LCD 1602 to display numbers and text.
makerbit.connectLcd(39)
makerbit.setLcdBacklight(LcdBacklight.Off)
makerbit.showStringOnLcd("MakerBit", 0)
makerbit.showNumberOnLcd(42, 16)
basic.pause(2000)
makerbit.clearLcd()
Connects to the LCD at a given I2C address.
makerbit.connectLcd(39)
Displays a string on the LCD at a given position. The text is wrapped automatically at line end.
makerbit.showStringOnLcd("Hello world", 0)
Displays a number on the LCD at a given position. The number is wrapped automatically at line end.
makerbit.showNumberOnLcd(42, 16)
Clears the LCD completely.
makerbit.clearLcd()
Enables or disables the backlight of the LCD.
makerbit.setLcdBacklight(LcdBacklight.On)
Turns a LCD position value into a number.
makerbit.position(LcdPosition.P16)
MIT
- for PXT/calliope