I'm using a relay to switch a power extension and think I may have incorrectly wired the relay. I would expect the code below to switch the power off but it switches the power on?
I have wired the first two connectors on K1 of this relay board I bought on Amazon.
https://www.amazon.co.uk/dp/B01BAFLMCI/ ... 41_TE_dp_1
Am I correct in thinking that GPIO.LOW should actually turn the relay on and if so how do I fix this?
Code: Select all
#!/usr/bin/python import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BCM) # init list with pin numbers pinList =  # loop through pins and set mode and state to 'low' for i in pinList: GPIO.setup(i, GPIO.OUT) GPIO.output(i, GPIO.HIGH) # time to sleep between operations in the main loop SleepTimeL = 2 # main loop try: GPIO.output(17, GPIO.HIGH) print "ONE" time.sleep(SleepTimeL); print "Good bye!" # End program cleanly with keyboard except KeyboardInterrupt: print " Quit" # Reset GPIO settings GPIO.cleanup()