- Notifications
You must be signed in to change notification settings - Fork8
Golang library to read data from Bosch BME280 sensor.
License
NotificationsYou must be signed in to change notification settings
quhar/bme280
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Golang library to read data from Bosch BME280 sensor. It requires library to talk to the device via following interface:
typebusinterface {ReadReg(byte, []byte)errorWriteReg(byte, []byte)error}
One of the libraries which matches this interface is experimental standard I/Olib.
package mainimport ("fmt""golang.org/x/exp/io/i2c""github.com/quhar/bme280")funcmain() {d,err:=i2c.Open(&i2c.Devfs{Dev:"/dev/i2c-1"},bme280.I2CAddr)iferr!=nil {panic(err)}b:=bme280.New(d)err=b.Init()t,p,h,err:=b.EnvData()iferr!=nil {panic(err)}fmt.Printf("Temp: %fC, Press: %fhPa, Hum: %f%%\n",t,p,h)}
About
Golang library to read data from Bosch BME280 sensor.
Resources
License
Stars
Watchers
Forks
Packages0
No packages published