Documentation ¶
Overview ¶
Package ht16k33 implements interfacing code to Holtek HT16K33 Alphanumeric 16x8 LED driver.
More Details ¶
Datasheets ¶
http://www.holtek.com/documents/10179/116711/HT16K33v120.pdf
Product Page ¶
http://www.holtek.com/productdetail/-/vg/HT16K33
Example ¶
// Make sure periph is initialized. if _, err := host.Init(); err != nil { log.Fatal(err) } bus, err := i2creg.Open("") if err != nil { log.Fatal(err) } defer bus.Close() display, err := ht16k33.NewAlphaNumericDisplay(bus, ht16k33.I2CAddr) if err != nil { log.Fatal(err) } defer display.Halt() if _, err := display.WriteString("ABCD"); err != nil { log.Fatal(err) } time.Sleep(1 * time.Second) if _, err := display.WriteString("GO"); err != nil { log.Fatal(err) } time.Sleep(1 * time.Second) if _, err := display.WriteString(fmt.Sprintf("%d", 1234)); err != nil { log.Fatal(err) } time.Sleep(1 * time.Second) if _, err := display.WriteString(fmt.Sprintf("%d", 60)); err != nil { log.Fatal(err) } time.Sleep(1 * time.Second) if _, err := display.WriteString(fmt.Sprintf("%5f", 23.99)); err != nil { log.Fatal(err) } time.Sleep(1 * time.Second) if _, err := display.WriteString(fmt.Sprintf("%5f", 1.45)); err != nil { log.Fatal(err) } time.Sleep(1 * time.Second)
Output:
Index ¶
Examples ¶
Constants ¶
const ( BlinkOff = 0x00 Blink2Hz = 0x02 Blink1Hz = 0x04 BlinkHalfHz = 0x06 )
Blinking frequencies.
const I2CAddr uint16 = 0x70
I2CAddr i2c default address.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlinkFrequency ¶
type BlinkFrequency byte
BlinkFrequency display frequency must be a value allowed by the HT16K33.
type Dev ¶
type Dev struct {
// contains filtered or unexported fields
}
Dev is a handler to ht16k33 controller
func NewI2C ¶
NewI2C returns a Dev object that communicates over I2C.
To use on the default address, ht16k33.I2CAddr must be passed as argument.
func (*Dev) SetBlink ¶
func (d *Dev) SetBlink(freq BlinkFrequency) error
SetBlink Blink display at specified frequency.
func (*Dev) SetBrightness ¶
SetBrightness of entire display to specified value.
Supports 16 levels, from 0 to 15.
type Display ¶
type Display struct {
// contains filtered or unexported fields
}
Display is a handler to control an alphanumeric display based on ht16k33.
func NewAlphaNumericDisplay ¶
NewAlphaNumericDisplay returns a Display object that communicates over I2C to ht16k33.
To use on the default address, ht16k33.I2CAddr must be passed as argument.