1
0
mirror of https://github.com/kidoman/embd synced 2025-01-03 10:31:36 +01:00
embd/samples/watersensor.go

26 lines
351 B
Go
Raw Normal View History

2013-12-23 16:39:52 +05:30
package main
import (
"log"
"time"
2014-02-10 05:05:41 +05:30
"github.com/kidoman/embd/sensor/watersensor"
2013-12-23 16:39:52 +05:30
)
func main() {
fluidSensor := watersensor.New(7)
for {
isWater, err := fluidSensor.IsWet()
if err != nil {
log.Panic(err)
}
2014-02-10 05:05:41 +05:30
if isWater {
log.Printf("Bot is dry")
} else {
log.Printf("Bot is Wet")
}
2013-12-23 16:39:52 +05:30
time.Sleep(500 * time.Millisecond)
}
}