staticcheck formatting
This commit is contained in:
parent
19c192f0e3
commit
12fc1f059a
16
cmd/ui/ui.go
16
cmd/ui/ui.go
|
@ -1,10 +1,10 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"time"
|
||||
i2c "github.com/d2r2/go-i2c"
|
||||
bh1750 "github.com/d2r2/go-bh1750"
|
||||
i2c "github.com/d2r2/go-i2c"
|
||||
logger "github.com/d2r2/go-logger"
|
||||
"time"
|
||||
)
|
||||
|
||||
var lg = logger.NewPackageLogger("main",
|
||||
|
@ -19,7 +19,9 @@ func main() {
|
|||
|
||||
// Create new connection to I2C to bh1750
|
||||
i2c, err := i2c.NewI2C(0x23, 1)
|
||||
if err != nil { lg.Fatal(err) }
|
||||
if err != nil {
|
||||
lg.Fatal(err)
|
||||
}
|
||||
|
||||
// Free I2C connection on exit
|
||||
defer i2c.Close()
|
||||
|
@ -29,13 +31,17 @@ func main() {
|
|||
|
||||
// Reset sensor prior to use
|
||||
err = sensor.Reset(i2c)
|
||||
if err != nil { lg.Fatal(err) }
|
||||
if err != nil {
|
||||
lg.Fatal(err)
|
||||
}
|
||||
|
||||
// Read sensor value over time
|
||||
for {
|
||||
resolution := bh1750.HighResolution
|
||||
lux, err := sensor.MeasureAmbientLight(i2c, resolution)
|
||||
if err != nil { lg.Fatal(err) }
|
||||
if err != nil {
|
||||
lg.Fatal(err)
|
||||
}
|
||||
|
||||
println("Illuminance:", lux, "lx")
|
||||
|
||||
|
|
Loading…
Reference in a new issue