Skip to content

Driver for "Micro:bit motor drive expansion board" Version 2 (Fork of https://github.com/DFRobot/pxt-motor)

License

Notifications You must be signed in to change notification settings

gretel/pxt-mecadrive

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

88 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MecaDrive

Micro:bit mecanum wheel and motor control library.

Table of Contents

Summary

MecaDrive is a motor control library for micro:bit, designed for DFRobot motor driver expansion boards (DFR0548). It provides intuitive blocks for controlling mecanum wheel robots and individual DC motors.

Perfect for educational robotics projects with kids!

Features

  • Mecanum Wheel Control: 10 directional movements (forward, backward, strafe left/right, rotate CW/CCW, 4 diagonal directions)
  • Heading-Based Control: Move in any direction using compass heading (0-360°) - perfect for navigation, tracking, and smooth directional control
  • DC Motor Control: Individual control of 4 DC motors (M1-M4) with configurable directions
  • Simulator Support: Visual feedback in MakeCode simulator for testing before deployment
  • Configurable: Runtime configuration for motor directions and brake strength
  • Kid-Friendly: Natural language blocks in English, German, and Chinese
  • Hardware Optimized: Handles HR8833 chip quirks automatically

Blocks

1. Mecanum Movement

Control omnidirectional movement with mecanum wheels:

  • Named Directions: Use dropdown to select Forward, Backward, Strafe Left/Right, Rotate CW/CCW, Diagonal (4 directions)
  • Heading Control: Use compass heading (0-360 degrees) for smooth directional control
    • 0° = Forward (North)
    • 90° = Strafe Right (East)
    • 180° = Backward (South)
    • 270° = Strafe Left (West)
    • 45°, 135°, 225°, 315° = Diagonal movements
    • Any angle for smooth omnidirectional movement
  • Variable speed (0-255)

2. DC Motor Control

Control individual motors M1-M4:

  • Clockwise/Counter-clockwise direction
  • Variable speed (0-255)
  • Motor stop (individual or all)

3. Configuration (Advanced)

  • Motor direction configuration (for different chassis layouts)
  • Brake strength adjustment for M3/M4 motors

Hardware Support

Compatible with DFRobot DFR0548 motor driver expansion board:

  • 4x DC motor outputs (M1-M4)
  • 9x IO interface pins (P0, P1, P2, P8, P12, P13, P14, P15, P16) with Gravity connectors
  • PCA9685 PWM controller via I2C

Note: The IO pins are standard micro:bit GPIO pins made accessible through Gravity connectors. Use standard micro:bit pin blocks for sensors, switches, and other digital/analog inputs.

License

GNU

Supported targets

  • for PXT/microbit

About

Driver for "Micro:bit motor drive expansion board" Version 2 (Fork of https://github.com/DFRobot/pxt-motor)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Contributors

Languages

  • TypeScript 100.0%