Skip to main content

RobotPy Rev Digit

RobotPy - 2026 python Code style: black Checked with mypy

A RobotPy module for control of the REV Robotics Digit Board. Ported from the Java repository: https://github.com/vampjaz/REVDigitBoard


Table of Contents

Installation

pip install robotpy-rev-digit

Usage

See the example robot.py file for an example for how to use the module.

import wpilib
from robotpy_rev_digit import RevDigitBoard

I2C_DEV_ADDR = 0x70
TEST_PATTERN = "   ABCDEFGHIJKLMNOPQRSTUVWXYZ*?@#   "


class MyRobot(wpilib.TimedRobot):
    """
    ##########################################################################
    RevDigitBoard Example Program
    This program is an example of how to use the RevDigitBoard class.
    """

    def robotInit(self):
        """
        This function is called upon program startup and should be used for any
        initialization code.
        """
        # initialize the robot
        self.timer = wpilib.Timer()
        self.robot = wpilib.RobotController
        self.rev_digit = RevDigitBoard()

    def robotPeriodic(self):
        """This function is called periodically regardless of the robot's state"""
        self.rev_digit.update()

    def teleopInit(self):
        """This function is run once each time the robot enters teleop mode."""
        self.timer.start()

    def teleopPeriodic(self):
        """This function is called periodically during teleop mode."""
        time = self.timer.get()
        idx = int(time // 1) % len(TEST_PATTERN)
        text = TEST_PATTERN[idx:]
        voltage = self.rev_digit.potentiometer_voltage

        # If neither button is pressed, show the timer
        if (not self.rev_digit.is_button_a_pressed) and (
            not self.rev_digit.is_button_b_pressed
        ):
            self.rev_digit.display_message(time)

        # If Button A is pressed, display the battery voltage
        elif self.rev_digit.is_button_a_pressed:
            self.rev_digit.display_message(voltage)

        # If Button B is pressed, display the test pattern
        elif self.rev_digit.is_button_b_pressed:
            self.rev_digit.display_message(text)

    def teleopExit(self):
        """This function is called when teleop mode ends."""
        self.timer.stop()

    def disabledPeriodic(self):
        """This function is called periodically when the robot is disabled"""
        voltage = self.robot.getBatteryVoltage()
        self.rev_digit.display_message(voltage)

License

robotpy-rev-digit is distributed under the terms of the GPL-3.0-only license.

Metadata

Release files for robotpy-rev-digit 2.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for robotpy-rev-digit 2.1.1
File Size Uploaded
robotpy_rev_digit-2.1.1.tar.gz 20.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for robotpy-rev-digit 2.1.1
File Interpreter ABI Platform
robotpy_rev_digit-2.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 39.1 kB

Release files / robotpy_rev_digit-2.1.1.tar.gz

Download URL robotpy_rev_digit-2.1.1.tar.gz
Size 20.9 kB
Tags Source
SHA-256 checksum
How to use checksums
db0e196cfba88e61bd75de2d2f843073d0648429ab5ba5ca25c5506dc854dd71
BLAKE2b-256 checksum
How to use checksums
edb541896269f5152f1343229f0c9ea49ed79b2d4bda7296c0082378e93b9b13
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.2

Release files / robotpy_rev_digit-2.1.1-py3-none-any.whl

Download URL robotpy_rev_digit-2.1.1-py3-none-any.whl
Size 18.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
722ba2bbd9fd8feb2563e60be58ad21c46731e3ffc0a223cfcf99679debab431
BLAKE2b-256 checksum
How to use checksums
da458804bdd5cf62c369380050ab922dfebedcdac18fd1cfb40fe6b2cbefb817
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.2

Release history Release notifications | RSS feed

This release

2.1.1 This release

2 release files

2.1.0

2 release files

1.1.0

2 release files

1.0.0

2 release files

0.9.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page