• Help with relay

    Help and Support
    3
    0 Votes
    3 Posts
    318 Views
    C

    One more piece of the puzzle...at the end of my script, if I remove the GPIO.cleanup(), then the light stays on.

    But, in subsequent calls to my script, I receive a warning that the channel is already in use. It doesn't stop the code, but the programmer in me doesn't like warnings.

    My question now is why does the cleanup function change the output of the GPIO pins?

  • 0 Votes
    3 Posts
    1k Views
    edmaul69E

    @Chillimonster you could use the 5v on the usb because it kills when you run a shutdown. Even if it is in "standby" and the power isnt fully cut off. Use the usb ground and 5v to power the relay and so when it gets power it flips the relay to turn on your light