Created
February 28, 2021 13:38
-
-
Save proofek/d035fc79be04fcc9007366144d3ee3fc to your computer and use it in GitHub Desktop.
golang led example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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