mirror of
https://github.com/stianeikeland/go-rpio.git
synced 2025-02-02 15:30:36 +01:00
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:
parent
904f4f9711
commit
b79c58a7a3
|
@ -17,11 +17,6 @@ import (
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
|
||||||
// Use mcu pin 10, corresponds to physical pin 19 on the pi
|
|
||||||
pin = rpio.Pin(10)
|
|
||||||
)
|
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
// Open and map memory to access gpio, check for errors
|
// Open and map memory to access gpio, check for errors
|
||||||
if err := rpio.Open(); err != nil {
|
if err := rpio.Open(); err != nil {
|
||||||
|
@ -32,6 +27,13 @@ func main() {
|
||||||
// Unmap gpio memory when done
|
// Unmap gpio memory when done
|
||||||
defer rpio.Close()
|
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
|
// Set pin to output mode
|
||||||
pin.Output()
|
pin.Output()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user