tinygo.org/x/drivers@v0.27.1-0.20240509133757-7dbca2a54349/examples/axp192/m5stack-core2-blinky/main.go (about)

     1  package main
     2  
     3  import (
     4  	"machine"
     5  	"time"
     6  
     7  	axp192 "tinygo.org/x/drivers/axp192/m5stack-core2-axp192"
     8  	"tinygo.org/x/drivers/i2csoft"
     9  )
    10  
    11  func main() {
    12  	i2c := i2csoft.New(machine.SCL0_PIN, machine.SDA0_PIN)
    13  	i2c.Configure(i2csoft.I2CConfig{Frequency: 100e3})
    14  
    15  	axp := axp192.New(i2c)
    16  	led := axp.LED
    17  
    18  	for {
    19  		led.Low()
    20  		time.Sleep(time.Millisecond * 500)
    21  
    22  		led.High()
    23  		time.Sleep(time.Millisecond * 500)
    24  	}
    25  }