package modem import ( "log" "time" gpio "github.com/stianeikeland/go-rpio/v4" ) type gpioPin struct { Pin gpio.Pin } func (p gpioPin) Init() error { return gpio.Open() } func (p gpioPin) sendOnOffSignal() { p.Pin.Output() log.Println("Power on 0/3 + 100ms") p.Pin.Low() p.Pin.Toggle() time.Sleep(100 * time.Millisecond) log.Println("Power on 1/3 + 3s") p.Pin.High() p.Pin.Toggle() time.Sleep(3 * time.Second) log.Println("Power on 2/3 + 30s") p.Pin.Low() p.Pin.Toggle() time.Sleep(30 * time.Second) log.Println("Power on 3/3") } func (p gpioPin) PowerOn() { p.sendOnOffSignal() } func (p *gpioPin) PowerOff() { p.sendOnOffSignal() }