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

initial commit

This commit is contained in:
Karan Misra 2013-12-07 23:11:06 +05:30
commit bc8776440f
9 changed files with 1034 additions and 0 deletions

28
samples/lsm303.go Normal file
View file

@ -0,0 +1,28 @@
package main
import (
"log"
"time"
"github.com/kid0m4n/go-rpi/i2c"
"github.com/kid0m4n/go-rpi/sensor/lsm303"
)
func main() {
bus, err := i2c.NewBus(1)
if err != nil {
log.Panic(err)
}
mems := lsm303.New(bus)
defer mems.Close()
for {
heading, err := mems.Heading()
if err != nil {
log.Panic(err)
}
log.Printf("Heading is %v", heading)
time.Sleep(500 * time.Millisecond)
}
}