1
0
mirror of https://github.com/kidoman/embd synced 2024-06-06 19:17:49 +02:00
embd/samples/bh1750Fvi.go
Kunal Powar 898041c4ce -Removed low resolution mode from bh1750fvi package
-Fixed bugs with i2c commands used for data acquisition
2013-12-20 00:43:40 +05:30

30 lines
464 B
Go

package main
import (
"log"
"time"
"github.com/kid0m4n/go-rpi/i2c"
"github.com/kid0m4n/go-rpi/sensor/bh1750Fvi"
)
func main() {
bus, err := i2c.NewBus(1)
if err != nil {
log.Panic(err)
}
lightingSensor := bh1750Fvi.New(bh1750Fvi.High, bus)
defer lightingSensor.Close()
for {
lighting, err := lightingSensor.Lighting()
if err != nil {
log.Panic(err)
}
log.Printf("Lighting is %v lx", lighting)
time.Sleep(500 * time.Millisecond)
}
}