mirror of
https://github.com/kidoman/embd
synced 2025-07-03 03:47:33 +02:00
make the framework easier to begin with
This commit is contained in:
parent
ef87ad7879
commit
3d08995000
26 changed files with 237 additions and 170 deletions
27
samples/gpiodirect.go
Normal file
27
samples/gpiodirect.go
Normal file
|
@ -0,0 +1,27 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/kidoman/embd/gpio"
|
||||
)
|
||||
|
||||
func main() {
|
||||
if err := gpio.Open(); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
defer gpio.Close()
|
||||
|
||||
if err := gpio.SetDirection(10, gpio.Out); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if err := gpio.DigitalWrite(10, gpio.High); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
time.Sleep(1 * time.Second)
|
||||
|
||||
if err := gpio.SetDirection(10, gpio.In); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue