Skip to content

Instantly share code, notes, and snippets.

@youngkin
Last active May 18, 2022 19:31
Show Gist options
  • Save youngkin/08f1091ea79be8c4cbd4d0bcc0e5e365 to your computer and use it in GitHub Desktop.
Save youngkin/08f1091ea79be8c4cbd4d0bcc0e5e365 to your computer and use it in GitHub Desktop.
func main() {
// stop channel is used to synchronize exiting the
// program so that the board is reset to the state
// it was in prior to the program starting.
stop := make(chan interface{})
// sigs is the channel used by Go's signals capability
// to notify the program that a signal has been raised.
sigs := make(chan os.Signal)
// signal.Notify() registers the program's interest
// in receiving signals and provides the channel used
// to send signals to the program.
signal.Notify(sigs, syscall.SIGINT, syscall.SIGKILL)
go signalHandler(sigs, stop)
// Initialize the rpio library
if err := rpio.Open(); err != nil {
fmt.Println(err)
os.Exit(1)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment