java.lang.Object
com.pi4j.crowpi.components.Component
com.pi4j.crowpi.components.internal.HT16K33
- Direct Known Subclasses:
SevenSegmentComponent
Implementation of HT16K33 LED driver chip used for segment displays.
Uses I2C via Pi4J for controlling the chip programmatically.
-
Field Summary
Modifier and TypeFieldDescriptionprotected final byte[]
Internal buffer where all digits get stored before being flushed to the display.protected final com.pi4j.io.i2c.I2C
-
Constructor Summary
ConstructorDescriptionHT16K33
(com.pi4j.io.i2c.I2C i2c) Creates a new HT16K33 instance using the given I2C instance from Pi4J. -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Clears the internal buffer without refreshing the display.void
refresh()
Flushes the internal buffer to the chip, causing it to be displayed.void
setBlinkRate
(int rate) Changes the desired blink rate for the seven-segment display.void
setBrightness
(int brightness) Changes the desired brightness for the seven-segment display.void
setEnabled
(boolean enabled) Specifies if the seven-segment display should be enabled or disabled.Methods inherited from class com.pi4j.crowpi.components.Component
sleep, triggerSimpleEvent
-
Field Details
-
buffer
protected final byte[] bufferInternal buffer where all digits get stored before being flushed to the display. -
i2c
protected final com.pi4j.io.i2c.I2C i2c
-
-
Constructor Details
-
HT16K33
public HT16K33(com.pi4j.io.i2c.I2C i2c) Creates a new HT16K33 instance using the given I2C instance from Pi4J.- Parameters:
i2c
- I2C instance
-
-
Method Details
-
clear
public void clear()Clears the internal buffer without refreshing the display. This means that the current contents of the displays are still being shown untilrefresh()
is called. -
refresh
public void refresh()Flushes the internal buffer to the chip, causing it to be displayed. The contents of the buffer will be preserved by this command. -
setEnabled
public void setEnabled(boolean enabled) Specifies if the seven-segment display should be enabled or disabled. This will activate/deactivate the internal system oscillator and turn the LEDs on/off.- Parameters:
enabled
- Display state
-
setBlinkRate
public void setBlinkRate(int rate) Changes the desired blink rate for the seven-segment display. This method expects an integer value within the range 0-3, with 0 being equal to no blinking and 3 being the fastest choice. The whole display is affected by this command which gets immediately applied.- Parameters:
rate
- Desired blink rate from 0-3
-
setBrightness
public void setBrightness(int brightness) Changes the desired brightness for the seven-segment display. This method expects an integer value within the range 0-15, with 0 being the dimmest and 15 the brightest possible value. The whole display is affected by this command which gets immediately applied.- Parameters:
brightness
- Desired brightness from 0-15
-