I am trying to manipulate the GPIO pins using python. I have used many examples from the web. However, I noticed weird behavior of GPIO ports.
1) If I make a port high, it becomes high momentarily and then again it turns low.
2) If I initialize a port for output then it stays high regardless of the value we set.
Can anyone please help me with that? I am using RPi 2.
import RPi.GPIO as GPIO
from time import sleep
GPIO.setmode(GPIO.BOARD)
GPIO.setup(12, GPIO.OUT)
GPIO.output(12, GPIO.HIGH)
sleep(10)
GPIO.output(12, GPIO.LOW)
sleep(10)
GPIO.output(12, GPIO.HIGH)
sleep(10)
GPIO.output(12, GPIO.LOW)
sleep(10)
GPIO.cleanup()