tinygo.org/x/drivers@v0.27.1-0.20240509133757-7dbca2a54349/examples/bh1750/main.go (about) 1 package main 2 3 import ( 4 "time" 5 6 "machine" 7 8 "tinygo.org/x/drivers/bh1750" 9 ) 10 11 func main() { 12 machine.I2C0.Configure(machine.I2CConfig{}) 13 sensor := bh1750.New(machine.I2C0) 14 sensor.Configure() 15 16 for { 17 lux := sensor.Illuminance() 18 println("Illuminance:", lux, "lx") 19 20 time.Sleep(500 * time.Millisecond) 21 } 22 }