tinygo.org/x/drivers@v0.27.1-0.20240509133757-7dbca2a54349/examples/tm1637/main.go (about) 1 package main 2 3 import ( 4 "machine" 5 "time" 6 7 "tinygo.org/x/drivers/tm1637" 8 ) 9 10 func main() { 11 12 tm := tm1637.New(machine.D2, machine.D3, 7) // clk, dio, brightness 13 tm.Configure() 14 15 tm.ClearDisplay() 16 17 tm.DisplayText([]byte("Tiny")) 18 time.Sleep(time.Millisecond * 1000) 19 20 tm.ClearDisplay() 21 22 tm.DisplayChr(byte('G'), 1) 23 tm.DisplayDigit(0, 2) // looks like O 24 time.Sleep(time.Millisecond * 1000) 25 26 tm.DisplayClock(12, 59, true) 27 28 for i := uint8(0); i < 8; i++ { 29 tm.Brightness(i) 30 time.Sleep(time.Millisecond * 200) 31 } 32 33 i := int16(0) 34 for { 35 tm.DisplayNumber(i) 36 i++ 37 time.Sleep(time.Millisecond * 50) 38 } 39 40 }