我正在考虑在家里安装一些漂亮的LED灯带的想法。但是在运行代码后,LED会保留最后给它们的颜色。所以我将颜色设置为RGB(0,0,0)以便将其关闭。所以我的问题是:他们现在关闭还是还在用电?
正确的方法是什么?
我正在树莓派上运行代码,并且正在使用Python。
我的代码:
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()
答案 0 :(得分:0)
您检查了理由吗?在使用Arduino之前,我曾使用过类似的条带,并且由于缺少接地而遇到了类似的问题。
这里是特定于您使用的硬件所面临的问题的链接。该链接讨论了一个地面问题。