Split out hhio

This commit is contained in:
Ian Gulliver
2022-09-24 16:35:03 -07:00
parent 65788a6620
commit f958e7d1c0
5 changed files with 20 additions and 8 deletions

25
hhio/relay.go Normal file
View File

@@ -0,0 +1,25 @@
package hhio
import "github.com/stianeikeland/go-rpio/v4"
type Relay struct {
pin rpio.Pin
}
func NewRelay(pin int) *Relay {
r := &Relay{
pin: rpio.Pin(pin),
}
r.pin.Output()
return r
}
func (r *Relay) On() {
r.pin.High()
}
func (r *Relay) Off() {
r.pin.Low()
}