Skip to main content
Yanked

This release has been yanked by its maintainers, and will be ignored by installers, except when explicitly specified.
Consider using release 2.1.1 instead.
Reason given by maintainers: 2.1.1 is better, use it

RobotPy Rev Digit

RobotPy - 2024 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.0

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.0
File Size Uploaded
robotpy_rev_digit-2.1.0.tar.gz 70.8 kB Details

Built distribution (wheel)

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

Total release size: 89.0 kB

Release files / robotpy_rev_digit-2.1.0.tar.gz

Download URL robotpy_rev_digit-2.1.0.tar.gz
Size 70.8 kB
Tags Source
SHA-256 checksum
How to use checksums
e3cce8a556151df44046f995614b5d286dcb66e10e4820d27aac2eccbbe90ac7
BLAKE2b-256 checksum
How to use checksums
ee3f9150fd37e36524024ff8b41bcb5f48903ab520a51cd7227edabcdf13f8ab
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.0-py3-none-any.whl

Download URL robotpy_rev_digit-2.1.0-py3-none-any.whl
Size 18.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b8ead9d62cf2436d4778ed15c2848bde643656b88e335a095dee6758f5f29a26
BLAKE2b-256 checksum
How to use checksums
880149363f3cd79721428707d87b56c84d0d27934c64f4bf91a702c466485afe
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

2.1.1

2 release files

This release

2.1.0 This release

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