Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/asenyshyn/ds18b20
- Owner: asenyshyn
- License: mit
- Created: 2017-11-08T21:48:35.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2017-11-09T08:20:28.000Z (about 7 years ago)
- Last Synced: 2024-11-16T01:42:03.991Z (about 1 month ago)
- Topics: ds18b20, golang, raspberry-pi, temperature-sensor
- Language: Go
- Size: 5.86 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ds18b20
Read sensor data from ds18b20 for Raspberry PI## Example
```go
package mainimport (
"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)
}
}
```