Skip to content

Instantly share code, notes, and snippets.

@proofek
Created February 28, 2021 13:38
Show Gist options
  • Save proofek/d035fc79be04fcc9007366144d3ee3fc to your computer and use it in GitHub Desktop.
Save proofek/d035fc79be04fcc9007366144d3ee3fc to your computer and use it in GitHub Desktop.
golang led example
package main
import (
"fmt"
"github.com/stianeikeland/go-rpio"
"os"
"time"
)
func main() {
if err := rpio.Open(); err != nil {
fmt.Println(err)
os.Exit(1)
}
defer rpio.Close()
pin := rpio.Pin(26)
pin.Output()
for x := 0; x < 20; x++ {
pin.Toggle()
time.Sleep(time.Second)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment