0

I am completely new to RPi and stuck unexpectedly. I am trying to create a simple python program to make my LED blink. Here are the two programs which are giving same outputs on terminal when I checked the status with gpio readall

1.

import RPi.GPIO as GPIO
import time

GPIO.setmode(GPIO.BCM)
GPIO.setup(4,GPIO.OUT)

for i in range(10):
        print "all good"
        GPIO.output(4,True)
        time.sleep(5)
        GPIO.output(4,False)
        time.sleep(5)


GPIO.cleanup()

2.

from gpiozero import LED
from time import sleep

led = LED(4)
print(led.value)
led.off()
i=0
while i<10:
    print("hi test")
    led.on()
    sleep(1)
    led.off()
    sleep(1)
    i+=1

When I check my LED circuits, it seems all good with 3.3V... however, when I change the pin to any other one LED is not blinking. In fact, nothing is happening.

Please help! Pin: 6 and 7th. The red wire is to ground. Resistor: 560 Ohm!

I am using Pi 1 B+ with raspbian stretch; Python 2.7 and 3.5

circuilt enter image description here enter image description here

  • You are asking us to guess how the LED is connected. That is a waste of our time. Please edit your question and add a photo of your connections. – joan Apr 9 '18 at 10:40
  • @joan. Please see. I have added images. Thank you. – Rishi Apr 9 '18 at 10:48
  • So, the red wire is ground, right? – Jaromanda X Apr 9 '18 at 10:50
  • so, on the LED, which pin is the anode and which is the cathode – Jaromanda X Apr 9 '18 at 10:51
  • 2
    Quite simply, you appear to be connecting to the wrong pins - get rid of the IDC cable and directly connect. – Milliways Apr 9 '18 at 10:59
0

In addition to other possible issues, you are using cables with round pins to connect to an IDC connector.

IDC connectors have a flat blade, designed to connect to a square pin.

Using round pins often results in unreliable contacts.

Use proper DuPont connectors to connect to the Pi directly, OR use one of the boards designed for IDC connectors on your breadboard.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.