Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/eternal-flame-ad/rpi-ms561101ba
reading ms561101ba sensors on raspberry pi
https://github.com/eternal-flame-ad/rpi-ms561101ba
air-quality air-quality-monitor air-quality-sensor barometer barometric-pressure i2c i2c-sensors iic ms5611 raspberry-pi temperature-sensor
Last synced: 18 days ago
JSON representation
reading ms561101ba sensors on raspberry pi
- Host: GitHub
- URL: https://github.com/eternal-flame-ad/rpi-ms561101ba
- Owner: eternal-flame-AD
- License: apache-2.0
- Created: 2019-02-28T12:47:49.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-03-01T03:09:46.000Z (almost 6 years ago)
- Last Synced: 2024-12-10T11:44:23.941Z (24 days ago)
- Topics: air-quality, air-quality-monitor, air-quality-sensor, barometer, barometric-pressure, i2c, i2c-sensors, iic, ms5611, raspberry-pi, temperature-sensor
- Language: Go
- Size: 10.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# rpi-ms561101ba
Reading [ms561101ba](https://www.te.com/usa-en/product-CAT-BLPS0036.html) sensors with wiringpi and golang on raspberry pi.
## Example
```golang
package mainimport (
"log"
"time"ms561101ba "github.com/eternal-flame-AD/rpi-ms561101ba"
)func main() {
handle, err := ms561101ba.Open(0x77)
if err != nil {
panic(err)
}
handle.Reset()
time.Sleep(100 * time.Millisecond)
p, err := handle.ReadPROM()
if err != nil {
panic(err)
}
for {
d1, err := handle.ReadPressureADC(4096)
if err != nil {
log.Printf("error while reading pressure ADC value: %s", err.Error())
}
d2, err := handle.ReadTemperatureADC(4096)
if err != nil {
log.Printf("error while reading temperature ADC value: %s", err.Error())
}
t, p := ms561101ba.CalcTemp(d2, p), ms561101ba.CalcPressure(d1, d2, p)
log.Printf("T=%.2f degC P=%.2f hPa", t, p)
}
}
```