I have a raspberry pi 2 Model B v1.1 and 7 color flash sensor. I want to flash the led to get my hand into practice. This is my first program with raspberry pi and unfortunately i failed to flash the led.
I am not using breadboard. I am using pi pin. For that i have used three female-female wire. One for connecting to 5v, one to ground and one to 11 number pin as a channel for supplying high or low voltage so when i use GPIO.output(11,True) led will flash. But it is not working. Here is my code.
7colorflash.py
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BOARD)
mode = GPIO.getmode()
if mode == GPIO.BOARD:
GPIO.setup(12,GPIO.OUT)
GPIO.output(12,True)
GPIO.output(12,False)
elif mode == GPIO.BCM:
GPIO.setup(18,GPIO.OUT)
GPIO.output(12,True)
GPIO.output(12,False)
else:
print('None')
GPIO.cleanup()
I have attached an image to show the connection. wire connected to 5v is in number 2 pin, ground in number 6 pin and channel number 11 is used.
What might be the cause for not flashing the led?