https://github.com/zack-wang/go-bmp280
BMP280 Atmosphere Pressure Sensor in Go
https://github.com/zack-wang/go-bmp280
bmp280 golang raspberrypi
Last synced: 6 months ago
JSON representation
BMP280 Atmosphere Pressure Sensor in Go
- Host: GitHub
- URL: https://github.com/zack-wang/go-bmp280
- Owner: zack-wang
- License: mit
- Created: 2020-01-03T00:42:40.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-01-05T05:56:36.000Z (almost 6 years ago)
- Last Synced: 2024-10-09T12:37:38.587Z (about 1 year ago)
- Topics: bmp280, golang, raspberrypi
- Language: Go
- Size: 8.79 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## input:
- d = "/dev/i2c-1"
- a = 0x76 (BMP280 on CJMCU8128 breakout board)
- accuracy = "ULTRA_LOW","LOW","STANDARD","HIGH","ULTRA_HIGH"## output:
- p = uint32 ( pressure in unit Pa )## Calibration:
Refer to https://cdn-shop.adafruit.com/datasheets/BST-BMP280-DS001-11.pdf## Find your device address
````
i2cdetect -y 1
````## Find BMP280 Device ID, should be 0x58 or 0x56 or 0x57
````
i2cget 1 0x76 0xD0
````## Sample Code
````
package main
import(
"log"
"github.com/zack-wang/go-bmp280")
func main(){
// Atmosphere Pressure
p,err:=bmp280.ReadPressurePa("/dev/i2c-1",0x76,"LOW")
if err!=nil{
log.Fatal("Not BMP280",err)
}else{
log.Println("p=",p)
}
}
````