Skip to main content

Micro:bit TinyBit BLE Python Library

Project description

Micro:bit TinyBit BLE Python Library

A Python package to control a custom Robot V2 via Bluetooth Low Energy (BLE) communication. The package provides an API for controlling the robot's movements and LED colors.


This project uses Poetry for package management. Install Poetry if you haven't already.

To install the package and its dependencies, run:

poetry install


The script demonstrates how to use the package to control the robot.

from weallcode_robot import Robot

robot = Robot("WAC")

robot.led(255, 0, 0)        # Set the LED color to red
robot.move(100, 100)        # Move forward
robot.wait(2)               # Wait for 2 seconds
robot.move(0, 0)            # Stop the robot
robot.move(-100, 100)       # Turn the robot
robot.wait(0.25)            # Wait for 0.25 seconds
robot.move(100, 100)        # Move forward
robot.wait(1)               # Wait for 1 second
robot.move(0, 0)            # Stop the robot
robot.move(-100, -100)      # Move backward
robot.wait(1)               # Wait for 1 second
robot.move(0, 0)            # Stop the robot

robot.led(0, 0, 0)          # Turn off the LED                 # Execute the commands



The Robot class is the main class to control the robot. Instantiate the class with the name of the robot.

robot = Robot("WAC")


  • led(r: int, g: int, b: int): Sets the LED color. Values should be integers between 0 and 255.
  • move(right: int, left: int): Sets the motor speeds. Values should be integers between -100 and 100.
  • wait(duration: float): Adds a wait command with a given duration in seconds.
  • run(): Executes the commands in the order they were added.


The package includes development dependencies:

  • black: Code formatter
  • pre-commit: Pre-commit hooks for code formatting and linting
  • isort: Import sorter
  • ruff: Linter

To install the development dependencies, run:

poetry install --extras dev

To run the pre-commit hooks, first install them:

pre-commit install

Then run:

pre-commit run --all-files


  • Blaine Rothrock
  • Ali Karbassi

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

weallcode_robot-3.0.2.tar.gz (3.8 kB view hashes)

Uploaded source

Built Distribution

weallcode_robot-3.0.2-py3-none-any.whl (4.5 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page