I am writing a Python app on my RPi to manage an 8-port Sainsmart relay. All that I need to do operate a port on that relay is to change the state on a GPIO pin to either low or high. I cannot find an obvious gpiozero object to simply change the state of a pin, though I can control it by pretending that it is an LED, e.g.:
import time from gpiozero import LED led = LED(27); led.on() time.sleep(10) led.off()
Is there a better way to do this? (I was looking at the pin factory stuff but that looks much more complicated...)
Also, I'd like to be able to read the state of said GPIO pin if it is possible (i.e. confirm the state of the pin).
If anyone cares, I have wired the relays to the RPi using this circuit (from Sainsmart) which converts them from "active low" to "active high":