added read test for reading bmp388

pull/827/head
ori 2023-08-31 15:57:27 +03:00 zatwierdzone przez Adrian Batzill
rodzic 379b56403b
commit 238b625f8a
1 zmienionych plików z 26 dodań i 0 usunięć

Wyświetl plik

@ -0,0 +1,26 @@
package main
import (
"fmt"
"github.com/b3nn0/stratux/sensors/bmp388"
"github.com/kidoman/embd"
"time"
)
func main() {
i2cbus := embd.NewI2CBus(1)
bmp := bmp388.BMP388{Bus: &i2cbus, Address: bmp388.Address}
fmt.Println("t,temp,press,alt")
clock := time.NewTicker(time.Millisecond)
for {
for _ = range clock.C {
p, _ := bmp.ReadPressure()
t, _ := bmp.ReadTemperature()
fmt.Printf("%3.2f,%4.2f\n", p, t)
}
}
}