mirror of
https://github.com/tinygo-org/drivers.git
synced 2026-07-26 10:38:41 +00:00
c09f0a8075
Signed-off-by: Ron Evans <ron@hybridgroup.com>
23 lines
311 B
Go
23 lines
311 B
Go
package main
|
|
|
|
import (
|
|
"time"
|
|
|
|
"machine"
|
|
|
|
"tinygo.org/x/drivers/bh1750"
|
|
)
|
|
|
|
func main() {
|
|
machine.I2C0.Configure(machine.I2CConfig{})
|
|
sensor := bh1750.New(machine.I2C0)
|
|
sensor.Configure()
|
|
|
|
for {
|
|
lux := sensor.Illuminance()
|
|
println("Illuminance:", lux, "lx")
|
|
|
|
time.Sleep(500 * time.Millisecond)
|
|
}
|
|
}
|