Documentation ¶
Overview ¶
Package tm1637 controls a TM1637 device over GPIO pins.
Datasheet ¶
http://olimex.cl/website_MCI/static/documents/Datasheet_TM1637.pdf
Example ¶
if _, err := host.Init(); err != nil { log.Fatalf("failed to initialize periph: %v", err) } dev, err := New(gpioreg.ByNumber(6), gpioreg.ByNumber(12)) if err != nil { log.Fatalf("failed to initialize tm1637: %v", err) } if err := dev.SetBrightness(Brightness10); err != nil { log.Fatalf("failed to set brightness on tm1637: %v", err) } if _, err := dev.Write(Clock(12, 00, true)); err != nil { log.Fatalf("failed to write to tm1637: %v", err) }
Output:
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Brightness ¶
type Brightness uint8
Brightness defines the screen brightness as controlled by the internal PWM.
const ( Off Brightness = 0x80 // Completely off. Brightness1 Brightness = 0x88 // 1/16 PWM Brightness2 Brightness = 0x89 // 2/16 PWM Brightness4 Brightness = 0x8A // 4/16 PWM Brightness10 Brightness = 0x8B // 10/16 PWM Brightness11 Brightness = 0x8C // 11/16 PWM Brightness12 Brightness = 0x8D // 12/16 PWM Brightness13 Brightness = 0x8E // 13/16 PWM Brightness14 Brightness = 0x8F // 14/16 PWM )
Valid brightness values.
type Dev ¶
type Dev struct {
// contains filtered or unexported fields
}
Dev represents an handle to a tm1637.
func (*Dev) SetBrightness ¶
func (d *Dev) SetBrightness(b Brightness) error
SetBrightness changes the brightness and/or turns the display on and off.
Click to show internal directories.
Click to hide internal directories.