Class FourDigitSevenSegmentDisplayHelper
java.lang.Object
com.opensourcewithslu.outputdevices.FourDigitSevenSegmentDisplayHelper
-
Constructor Summary
ConstructorsConstructorDescriptionFourDigitSevenSegmentDisplayHelper(com.pi4j.io.gpio.digital.DigitalOutput sdi, com.pi4j.io.gpio.digital.DigitalOutput rclk, com.pi4j.io.gpio.digital.DigitalOutput srclk, com.pi4j.io.gpio.digital.DigitalOutput digit0, com.pi4j.io.gpio.digital.DigitalOutput digit1, com.pi4j.io.gpio.digital.DigitalOutput digit2, com.pi4j.io.gpio.digital.DigitalOutput digit3) Constructor for the FourDigitSevenSegmentDisplayHelper class. -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clears the display.voiddisable()Disables the display.voidenable()Enables the display.Gets the display value.voidDisplays a value on the four-digit seven-segment display.voidsetDecimalPoint(int digit, boolean enabled) Sets the decimal point of a digit.voidsetDigit(int digit, char value) Sets the value of a digit.
-
Constructor Details
-
FourDigitSevenSegmentDisplayHelper
public FourDigitSevenSegmentDisplayHelper(com.pi4j.io.gpio.digital.DigitalOutput sdi, com.pi4j.io.gpio.digital.DigitalOutput rclk, com.pi4j.io.gpio.digital.DigitalOutput srclk, com.pi4j.io.gpio.digital.DigitalOutput digit0, com.pi4j.io.gpio.digital.DigitalOutput digit1, com.pi4j.io.gpio.digital.DigitalOutput digit2, com.pi4j.io.gpio.digital.DigitalOutput digit3) Constructor for the FourDigitSevenSegmentDisplayHelper class.- Parameters:
sdi- Serial data inputrclk- Register clocksrclk- Shift register clockdigit0- The first digitdigit1- The second digitdigit2- The third digitdigit3- The fourth digit
-
-
Method Details
-
clear
public void clear()Clears the display. -
enable
public void enable()Enables the display. -
disable
public void disable()Disables the display. -
print
Displays a value on the four-digit seven-segment display.- Parameters:
value- The value to display. It can include digits 0-9, letters A-F (case-insensitive), hyphens, spaces, and decimal points.
-
getDisplayValue
Gets the display value.- Returns:
- The display value
-
setDigit
public void setDigit(int digit, char value) Sets the value of a digit.- Parameters:
digit- The digit to set the value of (0-3)value- The value to set the digit to. Must be a digit 0-9, a letter A-F (case-insensitive), a hyphen, or a space
-
setDecimalPoint
public void setDecimalPoint(int digit, boolean enabled) Sets the decimal point of a digit.- Parameters:
digit- The digit to set the decimal point of (0-3)enabled- Whether the decimal point should be enabled or not
-