Initial commit

This commit is contained in:
Ian Gulliver
2022-09-24 16:29:26 -07:00
parent f937fae62c
commit 65788a6620
6 changed files with 176 additions and 0 deletions

25
relay.go Normal file
View File

@@ -0,0 +1,25 @@
package main
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()
}