crazy shit.
This commit is contained in:
1 parent
410210d269
commit
e54aeeb5af
1 file changed
+7
-1
@@ -1,6 +1,7 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
"periph.io/x/conn/v3/gpio"
|
"periph.io/x/conn/v3/gpio"
|
||||||
"periph.io/x/host/v3"
|
"periph.io/x/host/v3"
|
||||||
@@ -26,7 +27,12 @@ func blinkLight(d time.Duration, pin gpio.PinIO) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func getInput(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)
|
val := pin.WaitForEdge(500 * time.Millisecond)
|
||||||
log.WithField("pin", pin.String()).Infof("Received", val)
|
log.WithField("pin", pin.String()).Infof("Received", val)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user