2013-12-09 02:49:39 +05:30
|
|
|
/*
|
|
|
|
Package rpi provides modules which will help gophers deal with various sensors.
|
|
|
|
|
|
|
|
Use the default i2c bus to read/write data:
|
|
|
|
|
2014-02-10 05:05:41 +05:30
|
|
|
import "github.com/kidoman/embd/i2c"
|
2013-12-09 03:21:05 +05:30
|
|
|
...
|
2013-12-09 02:49:39 +05:30
|
|
|
value, err := i2c.ReadInt(0x1E, 0x03)
|
|
|
|
...
|
|
|
|
value := make([]byte, 6)
|
|
|
|
err := i2c.ReadFromReg(0x77, 0xF6, value)
|
|
|
|
...
|
|
|
|
err := i2c.WriteToReg(0x1E, 0x02, 0x00)
|
|
|
|
|
|
|
|
Read data from the BMP085 sensor:
|
|
|
|
|
2014-02-10 05:05:41 +05:30
|
|
|
import "github.com/kidoman/embd/sensor/bmp085"
|
2013-12-09 03:21:05 +05:30
|
|
|
...
|
2013-12-09 02:49:39 +05:30
|
|
|
temp, err := bmp085.Temperature()
|
|
|
|
...
|
|
|
|
altitude, err := bmp085.Altitude()
|
|
|
|
|
|
|
|
Find out the heading from the LSM303 magnetometer:
|
|
|
|
|
2014-02-10 05:05:41 +05:30
|
|
|
import "github.com/kidoman/embd/sensor/lsm303"
|
2013-12-09 03:21:05 +05:30
|
|
|
...
|
2013-12-09 02:49:39 +05:30
|
|
|
heading, err := lsm303.Heading()
|
|
|
|
*/
|
2014-02-27 04:24:53 +05:30
|
|
|
package embd
|