What errors result when you run the script?
Here are a few potential errors I can see:
- you could use
from time import sleep instead of
- you haven't put in the shebang line at the start of the script (
#!/usr/bin/env python) - this tells what you are using to run it what it is.
- You likely don't need
GPIO.output(12,GPIO.LOW) as I would of thought that
GPIO.output(12,GPIO.HIGH) would override it (you can also use
- With the
GPIO.setup(GPIO.OUT) line, I think you need to specify the pin number - so it would be
Another problem could be that you don't have it wired correctly - you can get help with pin numbers etc here. Try not get confused between the Board and BCM numbering
So something like this should work:
import RPi.GPIO as GPIO
from time import sleep