Last active
May 18, 2022 19:31
-
-
Save youngkin/08f1091ea79be8c4cbd4d0bcc0e5e365 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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