https://github.com/stianeikeland/go-rpio

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package main

import (
    "fmt"
    "github.com/stianeikeland/go-rpio/v4"
    "time"
)

func main() {

    err := rpio.Open()
    if err != nil {
        fmt.Println(err)
        return
    }
    pin := rpio.Pin(17)

    pin.Low()
    time.Sleep(5 * time.Second)
    pin.High()

}