I have this code:
import RPi.GPIO as GPIO import time try: GPIO.setmode(GPIO.BOARD) GPIO.setup(3, GPIO.OUT) GPIO.setup(12, GPIO.OUT) GPIO.output(12, GPIO.HIGH) GPIO.output(3, GPIO.HIGH) time.sleep(7.5) GPIO.output(12, GPIO.LOW) GPIO.output(3, GPIO.LOW) except: GPIO.cleanup() finally: GPIO.cleanup()
When the program exits, the LED connected to pin 3, (along with a 220 ohm resistor) stays on a little bit. Running
gpio readall reveals that the pin has been set to IN. (Which is what I suspect is causing the issue; as running
gpio export 2 out fixes the problem).
What am I doing wrong here?