crazy shit.

This commit is contained in:
didier committed 2024-08-09 10:27:55 -04:00
1 parent 410210d269
commit e54aeeb5af
1 file changed
+7 -1
+7 -1
View File
@@ -1,6 +1,7 @@
package main
import (
"fmt"
log "github.com/sirupsen/logrus"
"periph.io/x/conn/v3/gpio"
"periph.io/x/host/v3"
@@ -26,7 +27,12 @@ func blinkLight(d time.Duration, pin gpio.PinIO) {
}
func getInput(pin gpio.PinIO) {
for {
if err := pin.In(gpio.PullUp, gpio.BothEdges); err != nil {
fmt.Printf("WTF? %s\n", err)
return
}
for i := 0; i < 100; i++ {
val := pin.WaitForEdge(500 * time.Millisecond)
log.WithField("pin", pin.String()).Infof("Received", val)
}