Skip to content

Instantly share code, notes, and snippets.

@RichardBronosky
Created June 29, 2020 18:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RichardBronosky/ef68fde82adfa81af9a400decfff6416 to your computer and use it in GitHub Desktop.
Save RichardBronosky/ef68fde82adfa81af9a400decfff6416 to your computer and use it in GitHub Desktop.
Script for toggling my Raspberry Pi NeoPixel chromakey ringlight
#!/usr/bin/env python3
"""Script for toggling my Raspberry Pi NeoPixel chromakey ringlight
Usage:
activate with default power of 64/256:
./neo
activate full power:
./neo 64
deactivate:
./neo off
"""
import sys
from time import sleep
import board
import neopixel
brightness=0.1
# Choose an open pin connected to the Data In of the NeoPixel strip, i.e. board.D18
# NeoPixels must be connected to D10, D12, D18 or D21 to work.
pixel_pin = board.D18
#pixel_pin = board.D10
# The number of NeoPixels
num_pixels = 16 + 12
# The order of the pixel colors - RGB or GRB. Some NeoPixels have red and green reversed!
# For RGBW NeoPixels, simply change the ORDER to RGBW or GRBW.
ORDER = neopixel.GRBW
class cycle():
on = 1
off = 1
pixels = neopixel.NeoPixel(
pixel_pin,
num_pixels,
brightness=brightness,
auto_write=False,
pixel_order=ORDER
)
def on(green=64):
print("green: "+green)
pixels.fill((0, int(green), 0, 0))
pixels.show()
def off():
pixels.fill((0, 0, 0, 0))
pixels.show()
def main(args):
if args and args[0].lower() == 'off':
off()
elif args:
on(args[0])
else:
on()
if __name__ == "__main__":
main(sys.argv[1:])
@RichardBronosky
Copy link
Author

I purchased a "WS2812B Ring 5050 RGB SK6812 5050 RGBW Ring 93 241 Bits addressable leds DC5V" from seller "sz_jiufeng" on ebay and am driving them via Adafruit's Python libraries. I have brightness set to 0.1 or 0.2 and the color set to (0,64,0) which is only 1/4th of the full (0,255,0) that would be "full bright green" (so I'm guessing that to be around 1/40th or 1/20th power.) It works great. I have a "SILVER REFLECTIVE FABRIC sew on material width 39-inch by length 1 yard" purchased from ebay seller "speedyweboutlet" hung 5 feet from the camera/light and I am sitting about 2 feet from the camera/light.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment