I hadn't programmed on my RPi for a couple of months due to me focusing mainly on my education. Yesterday, finally the school year ended, and so I decided to start programming on my Pi again from the beginning. I wired everything up correctly using my breadboard and started creating some simple programs that altered my LED's state from on to off, dimming, etc... BTW it's an RGB led. I decided to write a code that would let you choose what colour you wanted the LED to light up in, however, it doesn't seem to work.
import RPi.GPIO as GPIO GPIO.setmode(GPIO.BOARD) GPIO.setup(11,GPIO.OUT) GPIO.output(11,0) GPIO.setup(13,GPIO.OUT) GPIO.output(13,0) GPIO.setup(15,GPIO.OUT) GPIO.output(15,0) try: while(True): request = raw_input("RGB -->") if (request == 1): GPIO.output(11,1) elif (request == 2): GPIO.output(13,1) elif (request == 3): GPIO.output(15,1) except KeyboardInterrupt: GPIO.cleanup()
When I choose a colour nothing happens, can anybody help me, please?