mirror of
https://github.com/kidoman/embd
synced 2024-11-14 05:28:54 +01:00
36 lines
492 B
Go
36 lines
492 B
Go
// +build ignore
|
|
|
|
package main
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/kidoman/embd/gpio"
|
|
)
|
|
|
|
func main() {
|
|
if err := gpio.Open(); err != nil {
|
|
panic(err)
|
|
}
|
|
defer gpio.Close()
|
|
|
|
led, err := gpio.NewDigitalPin(10)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
defer led.Close()
|
|
|
|
if err := led.SetDirection(gpio.Out); err != nil {
|
|
panic(err)
|
|
}
|
|
if err := led.Write(gpio.High); err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
time.Sleep(1 * time.Second)
|
|
|
|
if err := led.SetDirection(gpio.In); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|