1
0
Fork 0
mirror of https://github.com/kidoman/embd synced 2025-07-03 03:47:33 +02:00

gpio library for rpi

This commit is contained in:
Karan Misra 2014-02-17 03:41:53 +05:30
parent 283e8eb140
commit b7096cfe6c
6 changed files with 480 additions and 0 deletions

33
samples/gpio.go Normal file
View file

@ -0,0 +1,33 @@
package main
import (
"time"
"github.com/kidoman/embd/gpio"
)
func main() {
io := gpio.New()
defer io.Close()
pin, err := io.Pin("MOSI")
if err != nil {
panic(err)
}
if err := pin.Output(); err != nil {
panic(err)
}
if err := pin.ActiveLow(); err != nil {
panic(err)
}
if err := pin.Low(); err != nil {
panic(err)
}
time.Sleep(1 * time.Second)
if err := pin.Input(); err != nil {
panic(err)
}
}