1
0
Fork 0
mirror of https://github.com/kidoman/embd synced 2025-07-03 03:47:33 +02:00

Add initial support for isl29125 rgb sensor

This commit is contained in:
Ryan Cox 2014-09-25 19:12:04 -07:00
parent 03b5f0ceb6
commit 9a96639962
3 changed files with 212 additions and 0 deletions

36
samples/isl29125.go Normal file
View file

@ -0,0 +1,36 @@
// +build ignore
package main
import (
"fmt"
"time"
"github.com/kidoman/embd"
"github.com/kidoman/embd/sensor/isl29125"
_ "github.com/kidoman/embd/host/all"
)
func main() {
if err := embd.InitI2C(); err != nil {
panic(err)
}
defer embd.CloseI2C()
bus := embd.NewI2CBus(1)
isl := isl29125.New(isl29125.DefaultConfig, bus)
defer isl.Close()
for {
r, err := isl.Reading()
if err != nil {
panic(err)
}
fmt.Printf("%v", r)
time.Sleep(500 * time.Millisecond)
}
}