Skip to content

Commit

Permalink
chore: play buzzer when new message received
Browse files Browse the repository at this point in the history
  • Loading branch information
Topvennie committed Aug 12, 2024
1 parent e60ee4b commit a66696e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions api/cammie.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package api
import (
"fmt"
"net/http"
"scc/buzzer"
"scc/config"
"scc/screen"
"slices"
Expand Down Expand Up @@ -77,6 +78,7 @@ func cammiePostMessage(app *screen.ScreenApp, c *gin.Context) {
cammieMessages++

app.Cammie.Update(newMessage)
go buzzer.PlayBuzzer()

c.JSON(http.StatusOK, gin.H{"message": "Message received"})
}
2 changes: 1 addition & 1 deletion buzzer/buzzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var buzzerOptions = map[string]func(rpio.Pin){
"default": playMusic,
}

func playBuzzer() {
func PlayBuzzer() {
err := rpio.Open()
if err != nil {
log.Printf("Error: Unable to open pin: %s", err)
Expand Down

0 comments on commit a66696e

Please sign in to comment.