2014-02-17 03:41:53 +05:30
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
|
2014-02-27 04:24:53 +05:30
|
|
|
"github.com/kidoman/embd"
|
2014-02-17 03:41:53 +05:30
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
2014-02-27 04:24:53 +05:30
|
|
|
gpio, err := embd.NewGPIO()
|
2014-02-17 03:41:53 +05:30
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
2014-02-27 04:24:53 +05:30
|
|
|
defer gpio.Close()
|
2014-02-17 03:41:53 +05:30
|
|
|
|
2014-02-27 04:24:53 +05:30
|
|
|
led, err := gpio.DigitalPin(10)
|
|
|
|
if err != nil {
|
2014-02-17 03:41:53 +05:30
|
|
|
panic(err)
|
|
|
|
}
|
2014-02-27 04:24:53 +05:30
|
|
|
|
|
|
|
if err := led.SetDir(embd.Out); err != nil {
|
2014-02-17 03:41:53 +05:30
|
|
|
panic(err)
|
|
|
|
}
|
2014-02-27 04:24:53 +05:30
|
|
|
if err := led.Write(embd.High); err != nil {
|
2014-02-17 03:41:53 +05:30
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
time.Sleep(1 * time.Second)
|
|
|
|
|
2014-02-27 04:24:53 +05:30
|
|
|
if err := led.SetDir(embd.In); err != nil {
|
2014-02-17 03:41:53 +05:30
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
}
|