-1

Im working on doing some remote GPIO control (de)energizing relays. When I turn a relay on, it instantly turns off. That makes me assume that the output doesn't latch. I tried several of the classes used to control digital IO remotely but all of them behave the same.

from gpiozero import OutputDevice
from gpiozero.pins.pigpio import PiGPIOFactory

factory = PiGPIOFactory(host='d1p-woctorelay.local')

#RD1P Relays las_test = OutputDevice(15, pin_factory=factory)

las = LED(5, pin_factory=factory)

rex = LED(6, pin_factory=factory)

ras = LED(13, pin_factory=factory)

las_test.on()

las.on()

rex.off()

Is there something I'm missing in the docs or some basic trick to latching remotely? I came across this SO post but it doesn't seem to work the same for remote control.

addohm
  • 107
  • 6

1 Answers1

0

Im not sure about the why but as I built the script it started working as expected.

import argparse
from gpiozero import OutputDevice
from gpiozero.pins.pigpio import PiGPIOFactory

import argparse

parser = argparse.ArgumentParser(description='Start, stop, or start aux equipment') parser.add_argument('func', type=str, required=False, help='Function to perform [startup, shutdown, auxstart]')

args = parser.parse_args()

factory = PiGPIOFactory(host='d1p-woctorelay.local')

#RD1P Relays las = OutputDevice(15, pin_factory=factory) rex = OutputDevice(6, pin_factory=factory) ras = OutputDevice(13, pin_factory=factory)

def startup(): print('Starting up the machine.') las.on()

def shutdown(): print('Shutting down all equipment.') las.off() rex.off() ras.off()

def auxstart(): print('Starting up the auxilliary equipment.') rex.on() ras.on()

if name == "main": func = args.func if func == 'startup': startup() elif func == 'auxstart': auxstart() else: shutdown()

addohm
  • 107
  • 6