I connected an RGB LED(common anode) via the GPIO, and tried to get it to light up, but for some reason when I run the command, the LED does not light up. Here's the code I'm using
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BOARD)
GPIO.setup(11, GPIO.OUT)
GPIO.output(11,1)
GPIO.setup(13, GPIO.OUT)
GPIO.output(13,1)
GPIO.setup(15, GPIO.OUT)
GPIO.output(15,1)
try:
while(True):
request = raw_input("RGB:")
if(len(request) == 3):
GPIO.output(11, int(request[0]))
GPIO.output(13, int(request[1]))
GPIO.output(15, int(request[2]))
except KeyboardInterrupt:
GPIO.cleanup()
And this is what my setup looks like ![enter image description here][1] ![enter image description here][2]
Any ideas what I'm doing wrong? It's my first week working with my Raspberry Pi. [1]: https://i.sstatic.net/ZyrJX.jpg [2]: https://i.sstatic.net/UnAUG.jpg