From b79c58a7a36089e9e8ccab2a92f7f6d587acf9ea Mon Sep 17 00:00:00 2001 From: Aleksei Fedotov Date: Sun, 26 Apr 2020 17:36:56 +0200 Subject: [PATCH] Use physical PIN number in blinker example. The behavior of the test is not changed, now it hides BCM bin number and used physical PIN number. --- examples/blinker/blinker.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/examples/blinker/blinker.go b/examples/blinker/blinker.go index 8792b88..00fd653 100644 --- a/examples/blinker/blinker.go +++ b/examples/blinker/blinker.go @@ -17,11 +17,6 @@ import ( "time" ) -var ( - // Use mcu pin 10, corresponds to physical pin 19 on the pi - pin = rpio.Pin(10) -) - func main() { // Open and map memory to access gpio, check for errors if err := rpio.Open(); err != nil { @@ -32,6 +27,13 @@ func main() { // Unmap gpio memory when done defer rpio.Close() + // Use physical pin 19, mappings to GPIO numers are done internally + pin, err := rpio.GetBoardPin(19) + if err != nil { + fmt.Println(err) + os.Exit(1) + } + // Set pin to output mode pin.Output()