Skip to content

Commit

Permalink
log button presses better
Browse files Browse the repository at this point in the history
  • Loading branch information
sudermanjr committed Feb 18, 2023
1 parent f54770c commit 3245f20
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions pkg/dashboard/button.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
package dashboard

import (
"fmt"
"time"

"github.com/stianeikeland/go-rpio/v4"
)

func (a *App) WatchButton() {
if err := rpio.Open(); err != nil {
fmt.Println(err)
a.Logger.Errorw("could not init gpio", "error", err)
return
}
defer rpio.Close()
Expand All @@ -22,7 +21,7 @@ func (a *App) WatchButton() {

for {
if buttonPin.EdgeDetected() { // check if event occured
fmt.Println("button pressed")
a.Logger.Debugw("button pressed", "gpio", a.ButtonPin)
}
time.Sleep(time.Second / 2)
}
Expand Down

0 comments on commit 3245f20

Please sign in to comment.