Upon running the following script my relay stays open when the GPIO pin is set to output. In all my attempts. there has not been any way for me to alter this behaviour.
The code I've ran:
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
GPIO.setup(17, GPIO.OUT)
try:
print('1: ')
time.sleep(2)
GPIO.output(17, False)
print(GPIO.input(17))
print('2: ')
time.sleep(2)
GPIO.output(17, True)
print(GPIO.input(17))
print('3: ')
time.sleep(2)
GPIO.output(17, False)
print(GPIO.input(17))
print('4: ')
finally:
GPIO.cleanup()
The GPIO.input returns me changed values, output when code is ran:
1:
0
2:
1
3:
0
4:
This seems pretty odd to me, given that I am 100% sure I am powering on the right GPIO pin. The GPIO pin is High from the moment the pin is set as an output until when the GPIO gets cleaned.