Skip to main content

Main menu for pybricks

Project description

pybricks menu

Main menu for pybricks

Copyright (C) 2025 Joey Parrish

The pybricks firmware doesn't come with a menu or support for multiple programs like the default Spike firmware. This is a simple menu system and basic startup checks to make it easier for kids to get started coding missions.

The startup checks ensure they don't start runs while plugged in, and show battery status while charging. If the battery level is too low on startup, a warning animation will be shown. Please charge to avoid inaccuracies caused by low torque.

Sample usage

from pybricks.hubs import PrimeHub
from pybricks.parameters import Direction, Port
from pybricks.pupdevices import Motor
from pybricks.robotics import DriveBase

from pybricksmenu import main_menu, startup_checks


hub = PrimeHub()
left_motor = Motor(Port.A, Direction.COUNTERCLOCKWISE)
right_motor = Motor(Port.B, Direction.CLOCKWISE)
wheel_diameter = 175
wheel_separation = 200
drive = DriveBase(left_motor, right_motor, wheel_diameter, wheel_separation)
run = 1


def run1(drive: DriveBase) -> None:
    drive.straight(1000)


def run2(drive: DriveBase) -> None:
    drive.turn(720)


startup_checks(hub)

while True:
    run = main_menu(hub, num_items=9, item=run)
    if run == 1:
        run1(drive)
    elif run == 2:
        run2(drive)

Project details


Download files

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

Source Distribution

pybricksmenu-0.0.5.tar.gz (16.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pybricksmenu-0.0.5-py3-none-any.whl (17.0 kB view details)

Uploaded Python 3

File details

Details for the file pybricksmenu-0.0.5.tar.gz.

File metadata

  • Download URL: pybricksmenu-0.0.5.tar.gz
  • Upload date:
  • Size: 16.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for pybricksmenu-0.0.5.tar.gz
Algorithm Hash digest
SHA256 30985518483ecd91eac81e0f05e599eb910076f83de8d3d8e88874ae27ce32f1
MD5 f7077b359a76618a00d932f98efa4c01
BLAKE2b-256 37d1d3dd9b46c2aa4948b4f93d03d5c3b41899afed3bef00a2153d2015ea33fd

See more details on using hashes here.

File details

Details for the file pybricksmenu-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: pybricksmenu-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 17.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for pybricksmenu-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 2f05679260c96e19216368c8becb61e69d9bc48b0994bab0919bfba46a7c8282
MD5 3f28ab55c58836aa5f1c6cc0eef328d7
BLAKE2b-256 8e5a48aea88f08d534b674bae9e073143bbffd095c4f197708f7c2530d5facd3

See more details on using hashes here.

Supported by

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