Skip to main content
added 59 characters in body
Source Link
JChris
  • 113
  • 3

That's my current structure:

GPIO GPIO 2

The short metal of the LED (-) is connected to GND, and the longer (+) is in the port 26. This black "thing" (I don't know the name) is connected to my Pi B+ by a gray cable.

My code:

import RPi.GPIO as GPIO
import time                           

GPIO.setmode(GPIO.BOARD)
GPIO.setup(26, GPIO.OUT)
delay = 2
 
def turnon(pin):
    GPIO.output(pin, 1)
    return
 
def turnoff(pin):
    GPIO.output(pin, 0)
    return
 
while(True):      
    turnon(26)
    time.sleep(delay)
    turnoff(26)
    time.sleep(delay)

I run this code as root (because it orders me to do that). The problem is that when I execute this code nothing happens. I don't get any errors and the LED doesn't blink.

The Pi I bought was this one: http://www.amazon.com/CanaKit-Raspberry-Ultimate-Starter-Components/dp/B00G1PNG54

That's my current structure:

GPIO

The short metal of the LED (-) is connected to GND, and the longer (+) is in the port 26. This black "thing" (I don't know the name) is connected to my Pi B+ by a gray cable.

My code:

import RPi.GPIO as GPIO
import time                           

GPIO.setmode(GPIO.BOARD)
GPIO.setup(26, GPIO.OUT)
delay = 2
 
def turnon(pin):
    GPIO.output(pin, 1)
    return
 
def turnoff(pin):
    GPIO.output(pin, 0)
    return
 
while(True):      
    turnon(26)
    time.sleep(delay)
    turnoff(26)
    time.sleep(delay)

I run this code as root (because it orders me to do that). The problem is that when I execute this code nothing happens. I don't get any errors and the LED doesn't blink.

The Pi I bought was this one: http://www.amazon.com/CanaKit-Raspberry-Ultimate-Starter-Components/dp/B00G1PNG54

That's my current structure:

GPIO GPIO 2

The short metal of the LED (-) is connected to GND, and the longer (+) is in the port 26. This black "thing" (I don't know the name) is connected to my Pi B+ by a gray cable.

My code:

import RPi.GPIO as GPIO
import time                           

GPIO.setmode(GPIO.BOARD)
GPIO.setup(26, GPIO.OUT)
delay = 2
 
def turnon(pin):
    GPIO.output(pin, 1)
    return
 
def turnoff(pin):
    GPIO.output(pin, 0)
    return
 
while(True):      
    turnon(26)
    time.sleep(delay)
    turnoff(26)
    time.sleep(delay)

I run this code as root (because it orders me to do that). The problem is that when I execute this code nothing happens. I don't get any errors and the LED doesn't blink.

The Pi I bought was this one: http://www.amazon.com/CanaKit-Raspberry-Ultimate-Starter-Components/dp/B00G1PNG54

Source Link
JChris
  • 113
  • 3

Question about Breadboard positioning

That's my current structure:

GPIO

The short metal of the LED (-) is connected to GND, and the longer (+) is in the port 26. This black "thing" (I don't know the name) is connected to my Pi B+ by a gray cable.

My code:

import RPi.GPIO as GPIO
import time                           

GPIO.setmode(GPIO.BOARD)
GPIO.setup(26, GPIO.OUT)
delay = 2
 
def turnon(pin):
    GPIO.output(pin, 1)
    return
 
def turnoff(pin):
    GPIO.output(pin, 0)
    return
 
while(True):      
    turnon(26)
    time.sleep(delay)
    turnoff(26)
    time.sleep(delay)

I run this code as root (because it orders me to do that). The problem is that when I execute this code nothing happens. I don't get any errors and the LED doesn't blink.

The Pi I bought was this one: http://www.amazon.com/CanaKit-Raspberry-Ultimate-Starter-Components/dp/B00G1PNG54