1
0
mirror of https://github.com/kidoman/embd synced 2024-12-22 04:40:04 +01:00

added water sensor sample

This commit is contained in:
Kashyap Kopparam 2013-12-23 16:39:52 +05:30
parent 35cbc690a5
commit 534e903925
3 changed files with 26 additions and 1 deletions

BIN
samples/watersensor Executable file

Binary file not shown.

25
samples/watersensor.go Normal file
View File

@ -0,0 +1,25 @@
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)
}
}

View File

@ -84,7 +84,7 @@ func (d *us020) Distance() (distance float64, err error) {
}
if d.debug {
log.Print("trigetting pulse")
log.Print("trigerring pulse")
}
// Generate a TRIGGER pulse