func main() { bus, err := i2c.NewBus(1) if err != nil { log.Panic(err) } baro := bmp085.New(bus) defer baro.Close() for { temp, err := baro.Temperature() if err != nil { log.Panic(err) } log.Printf("Temp is %v", temp) pressure, err := baro.Pressure() if err != nil { log.Panic(err) } log.Printf("Pressure is %v", pressure) altitude, err := baro.Altitude() if err != nil { log.Panic(err) } log.Printf("Altitude is %v", altitude) time.Sleep(500 * time.Millisecond) } }
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) } }