I am trying to light a led with the raspberry pi 3b, but I am failing to get an output.
I connected the LED to physical pin #11: [img]https://i.imgur.com/TYeJc10.jpg[/img] And to physical pin #6(ground).
I tried using both gpiozero and RPi.GPIO:
from gpiozero import LED
from time import sleep
led = LED(17)
led.on()
print('on')
sleep(3)
led.off()
print('off')
and
import RPi.GPIO as GPIO
import time
ledpin = 11
GPIO.setmode(GPIO.BOARD)
GPIO.setup(ledpin, GPIO.OUT)
while True:
GPIO.output(ledpin, GPIO.HIGH)
time.sleep(1)
GPIO.output(ledpin, GPIO.LOW)
time.sleep(1)
For RPi.GPIO I tried both BOARD and BCM, neither worked. I used [code]gpio readall[/code] from wiringpi, and it shows output but never a 1. I also used gpiotest with pigpio which gave no errors:
Testing...
Skipped non-user gpios: 0 1 28 29 30 31
Tested user gpios: 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
Failed user gpios: None
I also freshly installed the Raspbian OS. The LED does work when I connect one end to the 3.3V pin. I am however able to read input, using the following code:
import RPi.GPIO as GPIO
import time
switch = 31
GPIO.setmode(GPIO.BOARD)
GPIO.setup(switch, GPIO.IN)
for i in range(25):
time.sleep(1)
print(GPIO.input(switch))
GPIO.cleanup()
And getting 1/0 as output correctly
Anyone got a clue on how to fix this, I am all out of ideas and so seems google. Also it is the 2nd Raspberry pi I had this problem with.