I’m running the latest raspbian on a RPi 3B, everything else is up to date.
Is there anything the AutomationHAT or PiMoroni has to offer to cleanup the GPIO pins when exiting a python script? I noticed that the I/O all keep their last state when my python program closes, and I need to power down to clear the I/O.
Any help on a solution is appreciated.
I believe the python command to do that is GPIO.cleanup()
I see, which brings me to another point. I might be going about this the wrong way. I’m about to test it anyway - but is there going to be any difference referencing these GPIO pins that the automation HAT uses for (Relays, Buffered Inputs, Outputs, ETC…) by using the automationhat library vs gpioZero vs GPIO libraries?
For example, if i say
import automationhat
from time import sleep
automationhat.relay.one.on()
sleep(2)
automationhat.relay.one.off()
sleep(2)
automationhat.relay.one.on()
sleep(2)
automationhat.relay.one.off()
Is that equivalent to
from gpiozero import LED
from time import sleep
output1 = LED(13)
output1.on()
sleep(1)
output1.off()
sleep(2)
output1.on()
sleep(1)
output1.off()
Yes, If i use GPIOzero, the indicator light does not light up when the relay is activated. The relay does switch from NC to NO still.
Using the automationHAT library toggles the relay state and activates the relay light indicator.
Automation Hat Pinout is here
The LED’s are likely controlled over i2c. 0x54: SN3218.
I would think the automation library knows to turn the LED on when the Relay is on.
And using anything else you need to do two steps, turn the relay on and turn on the corresponding LED.