简体   繁体   中英

How to turn a LED-Strip off

I was playing with the idea to install some nice LED-strips in my home. But after running the code the LEDs would keep the last colore they were given. So I set the color to RGB(0,0,0) in order to turn turn them off. So my question is: Are they now turned of or are they still using electricity?

And what is the right way to do it?

I'm running the code on my raspberry pi and I am using Python.

My code:

import board
import time
import neopixel


# Choose an open pin connected to the Data In of the NeoPixel strip.
pixel_pin = board.D18

# Choose the number of NeoPixels.
num_pixels = 2

# Choose the order of the pixel colors - RGB or GRB.
ORDER = neopixel.RGB 

pixels = neopixel.NeoPixel(pixel_pin, num_pixels, brightness=0.0, auto_write=False, pixel_order=ORDER)

# Show red.
pixels.fill((255,0,0))
pixels.show()

time.sleep(2)

# Turn them off.
pixels.fill((0,0,0))
pixels.show()

Have you checked your grounds? I have used strips like these before using an Arduino and I had similar issues because of a missing ground connection.

Here is a link specific to the issue you are facing with the hardware you are using. The link discusses a ground issue.

https://forums.adafruit.com/viewtopic.php?f=47&t=81506

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM