0

Here is an image which shows how I connected the led with the pins:

Pin connected like this

The led is on every time. I am trying to turn off it with this code but it didn't work. Does anyone have an idea why is it still lighted?

from gpiozero import LED
led = LED(18)
led.off()
B--rian
  • 5,578
  • 10
  • 38
  • 89
Paul Vio
  • 57
  • 1
  • 7
  • Welcome to SO, Paul! Please edit your question, elaborate a bit more on what you tried, and why you have not been successful. – B--rian Aug 08 '19 at 15:22

1 Answers1

1

This appears to be an RGB LED. It will have a common cathode (or anode) and three remaining leads for red, green and blue. You appear to have connected power to one of those leads, which will cause it to light (in one color). Assuming the GPIO 18 lead is off at initialization, turning it off will have no effect. I suggest you check that you have the right wiring diagram.

lcongdon
  • 36
  • 4
  • thank you. I didn't notice it is an RGB LED, but now it makes sense. I am a beginner in this area with wires, LEDs, etc. I will try to find a good wiring diagram. Thanks again for helping me. – Paul Vio Aug 08 '19 at 15:32
  • 1
    If you can't find what you need for the Raspberry Pi, also search for Arduino wiring. Different platform, but the wiring will follow the same patterns. – lcongdon Aug 08 '19 at 16:03