bbr-buttonboard
Python client for the BBR Button Board, a modular driver station panel for FIRST robotics.
The board works as a game controller with nothing installed. This library is for making the panel react to the robot: a short script on the Driver Station laptop reads robot state (from NetworkTables, in FRC) and sets key colours, display text and pictures to match.
Install
pip install bbr-buttonboard
Python 3.9 or newer. The only dependency is pyserial. Two extras:
pip install "bbr-buttonboard[pictures]" # Pillow, to load images onto display tiles
pip install "bbr-buttonboard[networktables]" # pyntcore, for the companion app
A first script
from buttonboard import Board
with Board.open() as board: # finds the port by itself
leds = board.led_layer()
while True:
arm_fault = read_from_networktables("arm_fault")
in_range = read_from_networktables("in_scoring_range")
leds.set(3, "red" if arm_fault else "off")
leds.set(7, "green" if in_range else "off", fx="breathe")
leds.flush() # sends only what changed
Display tiles take text the same way:
board.screen(5).text(0, "ABORT", fg="black", bg="red").flush()
MockBoard is an in-process board, so a script can be written and tested
with no hardware attached:
from buttonboard import MockBoard
board = MockBoard()
board.led(3, "red")
print(board.state.leds) # {('btn', 3): 'led 3 FF0000'}
Only one program can have the board open at a time. Close the config app's browser tab before running a script, and the other way round.
bbctl
Installing the package also installs bbctl, a console for the board's
config channel:
bbctl # interactive
bbctl hello stats # run commands and exit
bbctl -p COM7 "led reset" # explicit port
Documentation
Tests
python tests/test_buttonboard.py
No hardware and no pytest needed.
About this repository
This is a published copy of the library. It is developed alongside the Button Board firmware and exported here for each release, so a pull request is welcome but will be applied upstream and come back in the next export.
The § references in the source point into the Button Board protocol
specification, which is not published yet.
Licence
MIT. See LICENSE.
Metadata
Release files for bbr-buttonboard 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| bbr_buttonboard-0.1.1.tar.gz | 61.9 kB | With provenance | Details for bbr_buttonboard-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| bbr_buttonboard-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for bbr_buttonboard-0.1.1-py3-none-any.whl |
Total release size: 118.7 kB
Security for bbr-buttonboard 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.