Skip to content

Commit b79c58a

Browse files
author
Aleksei Fedotov
committed
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.
1 parent 904f4f9 commit b79c58a

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

examples/blinker/blinker.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,6 @@ import (
1717
"time"
1818
)
1919

20-
var (
21-
// Use mcu pin 10, corresponds to physical pin 19 on the pi
22-
pin = rpio.Pin(10)
23-
)
24-
2520
func main() {
2621
// Open and map memory to access gpio, check for errors
2722
if err := rpio.Open(); err != nil {
@@ -32,6 +27,13 @@ func main() {
3227
// Unmap gpio memory when done
3328
defer rpio.Close()
3429

30+
// Use physical pin 19, mappings to GPIO numers are done internally
31+
pin, err := rpio.GetBoardPin(19)
32+
if err != nil {
33+
fmt.Println(err)
34+
os.Exit(1)
35+
}
36+
3537
// Set pin to output mode
3638
pin.Output()
3739

0 commit comments

Comments
 (0)