Connect with us

Raspberry Pi wiring simple LED

Discussion in 'Microcontrollers, Programming and IoT' started by crystal please, Mar 6, 2017.

Scroll to continue with content
  1. crystal please

    crystal please

    10
    0
    Jul 5, 2016
    I'm completely new to hardware in general. I just got a raspberry pi and was messing around trying to get an LED to light up.

    I have everything wired like the picture below. I am using a 330ohm resister, which I believe is bigger therefore ok then what is required.
    [​IMG]
    also (sorry this is my first time using any program to draw a circuit)
    [​IMG]
    The program runs successfully, but no light comes on. I know the LED is good as I've tested it on the arduino. Anybody care to explain my wiring fault?
    Code:
    [email protected]:/home/pi# cat test.py
    #!/usr/bin/python
    import RPi.GPIO as GPIO
    
    GPIO.setmode(GPIO.BOARD)
    GPIO.setup(11, GPIO.OUT)
    
    GPIO.output(11, True)
    Changing to GPIO pin 0 results
    Code:
    Traceback (most recent call last):
      File "test.py", line 5, in <module>
        GPIO.setup(0, GPIO.OUT)
    RPi.GPIO.InvalidChannelException: The channel sent is invalid on a Raspberry Pi
    [email protected]:/home/pi#
     
  2. Kaare Jenssen

    Kaare Jenssen

    6
    0
    Feb 22, 2017
    Hi.

    Are you sure the led is connected the right way?

    Check if the two pins you connect actually gives a voltage output on your voltmeter when you run your program.
     
  3. Harald Kapp

    Harald Kapp Moderator Moderator

    9,632
    2,013
    Nov 17, 2011
    Try 'GPIO.setmode(GPIO.BCM)' or when using GPIO.BOARD use pin #23.

    See here for more.
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-