Class REVDigitMXPDisplay


  • public class REVDigitMXPDisplay
    extends java.lang.Object
    Bindings for a REV Digit MXP Display wired to the MXP Port of a RoboRIO. Note that only one MXP Display can be controlled per robot. Because of this, the class is provided as a singleton.
    Since:
    0.1.0
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void clear()
      Clears the display by sending it four spaces.
      void displayBattery()
      format defaults to a DecimalFormat with pattern string "##.0V"
      void displayBattery​(java.text.DecimalFormat format)
      Displays current battery voltage.
      void displayBatterySOC()
      Displays the battery's State of Charge as a percentage.
      void displayScrollText​(java.lang.String text, double delay)
      Sets string to scroll across display (should be called every loop of robot program)
      void displayText​(java.lang.String text)
      Writes string to the display board
      boolean getAButtonPressed()
      returns true the first function call that the A button is pressed for.
      boolean getBButtonPressed()
      returns true the first function call that the B button is pressed for.
      boolean getButtonA()
      Get value of button A's DigitalInput.
      boolean getButtonB()
      Get value of button B's DigitalInput.
      boolean getDebug()
      Get whether or not the MXP Display is in debug mode.
      static REVDigitMXPDisplay getInstance()
      Fetches the singleton instance of this class
      double getPot()
      Get voltage across the potentiometer.
      void setDebug​(boolean debug)
      Set whether or not the MXP Display is in debug mode.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getDebug

        public boolean getDebug()
        Get whether or not the MXP Display is in debug mode. While in debug mode, the string to be displayed will be printed out alongside being displayed.
        Returns:
        debug mode state
      • setDebug

        public void setDebug​(boolean debug)
        Set whether or not the MXP Display is in debug mode. While in debug mode, the string to be displayed will be printed out alongside being displayed.
        Parameters:
        debug - desired debug mode state
      • getInstance

        public static REVDigitMXPDisplay getInstance()
        Fetches the singleton instance of this class
        Returns:
        singleton of the REV Display
      • displayText

        public void displayText​(java.lang.String text)
        Writes string to the display board
        Parameters:
        text - the text to be written. Characters after the fourth (excluding periods) will be ignored, as will periods placed before the first occurence of a non-period character. Strings with less than four non-period character will be padded with spaces to the right.
      • displayScrollText

        public void displayScrollText​(java.lang.String text,
                                      double delay)
        Sets string to scroll across display (should be called every loop of robot program)
        Parameters:
        text - The text to be written. Text will be processed similarly to displayText(String) Note that because text is processed with the same rules as displayText(String), nothing will be shown on the display when the scrolling section contains only periods.
        delay - Delay between character movements in seconds
        See Also:
        displayText(String)
      • displayBattery

        public void displayBattery​(java.text.DecimalFormat format)
        Displays current battery voltage.
        Parameters:
        format - DecimalFormat to display voltage with
      • displayBattery

        public void displayBattery()
        format defaults to a DecimalFormat with pattern string "##.0V"
        See Also:
        displayBattery(DecimalFormat)
      • displayBatterySOC

        public void displayBatterySOC()
        Displays the battery's State of Charge as a percentage. This value is calculated according to this chart. Generally, a value above 80% should work for the purposes of an FRC Robot
      • clear

        public void clear()
        Clears the display by sending it four spaces.
      • getButtonA

        public boolean getButtonA()
        Get value of button A's DigitalInput.
        Returns:
        true if button is released, false if button is held
      • getButtonB

        public boolean getButtonB()
        Get value of button B's DigitalInput.
        Returns:
        true if button is released, false is button is held
      • getPot

        public double getPot()
        Get voltage across the potentiometer.
        Returns:
        voltage running through potentiometer
      • getAButtonPressed

        public boolean getAButtonPressed()
        returns true the first function call that the A button is pressed for.
        Returns:
        whether or not the A button has been pressed
      • getBButtonPressed

        public boolean getBButtonPressed()
        returns true the first function call that the B button is pressed for.
        Returns:
        whether or not the B button has been pressed