Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/asenyshyn/ds18b20

Read sensor data from ds18b20 for Raspberry PI
https://github.com/asenyshyn/ds18b20

ds18b20 golang raspberry-pi temperature-sensor

Last synced: 23 days ago
JSON representation

Read sensor data from ds18b20 for Raspberry PI

Awesome Lists containing this project

README

        

# ds18b20
Read sensor data from ds18b20 for Raspberry PI

## Example

```go
package main

import (
"log"
"sync"
"time"

"github.com/asenyshyn/ds18b20"
)

func main() {
sensors, err := ds18b20.Sensors()
if err != nil {
log.Fatal(err)
}

var wg sync.WaitGroup

for {
wg.Add(len(sensors))
for _, s := range sensors {
go func(s ds18b20.Sensor) {
t, err := s.Reading()
if err != nil {
log.Fatal(err)
}
log.Println(s.ID, t.Value)
wg.Done()
}(s)
}
wg.Wait()
time.Sleep(time.Second * 5)
}
}
```