Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

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 main

import (
"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)
}
}
```