1
0
mirror of https://github.com/kidoman/embd synced 2024-12-22 12:50:19 +01:00
embd/samples/watersensor.go
2014-02-10 05:10:06 +05:30

26 lines
351 B
Go

package main
import (
"log"
"time"
"github.com/kidoman/embd/sensor/watersensor"
)
func main() {
fluidSensor := watersensor.New(7)
for {
isWater, err := fluidSensor.IsWet()
if err != nil {
log.Panic(err)
}
if isWater {
log.Printf("Bot is dry")
} else {
log.Printf("Bot is Wet")
}
time.Sleep(500 * time.Millisecond)
}
}