1
0
mirror of https://github.com/kidoman/embd synced 2024-12-22 12:50:19 +01:00
embd/samples/watersensor.go
2013-12-23 16:39:52 +05:30

26 lines
369 B
Go

package main
import (
"log"
"time"
"github.com/kid0m4n/go-rpi/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)
}
}