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.
This commit is contained in:
Aleksei Fedotov 2020-04-26 17:36:56 +02:00
parent 904f4f9711
commit b79c58a7a3

View File

@ -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()