BBR Button Board Documentation

Install the library#

The Button Board can be driven from a program on the Driver Station laptop โ€” reading robot state from NetworkTables and pushing LED colours and display text back to the panel. bb is the Python library for that.

You do not need this to use the board. Buttons work through the Driver Station with nothing installed. This is for making the panel react to the robot.

What you need#

  • Python 3.9 or newer.
  • pyserial.
python3 -m pip install pyserial

The library itself lives in tools/bb/ in the repository. Copy that directory next to your script, or put its parent on PYTHONPATH:

export PYTHONPATH=/path/to/BBRControlBoard/tools

Check it works#

from bb import Board

with Board.open() as board:          # finds the COM port by itself
    print(board.hello())
{'ok': True, 'product': 'Button Board', 'fw': '0.1.0', 'proto': 1, ...}

If it cannot find the board, pass the port explicitly โ€” Board.open(port="COM7") on Windows, Board.open(port="/dev/ttyACM0") on Linux.

Without a board#

MockBoard lets you write and test a companion app with no hardware attached:

from bb import MockBoard

board = MockBoard()
board.led(3, "red")
print(board.state.leds)      # {('btn', 3): 'led 3 FF0000'}

One connection at a time#

Only one program can have the board open. If the config app has it open in a browser tab, your script cannot open it, and the other way round. Close one before starting the other.