25 lines
544 B
Python
Executable file
25 lines
544 B
Python
Executable file
#!/usr/bin/env python3
|
|
|
|
import board
|
|
import neopixel
|
|
import sys
|
|
|
|
np_pin = board.D18
|
|
np_num = 16
|
|
np_order = neopixel.GRB
|
|
|
|
fname = "/tmp/pixel"
|
|
np = neopixel.NeoPixel(np_pin, np_num, auto_write=False, pixel_order=np_order)
|
|
|
|
c = (0,0,0)
|
|
try:
|
|
if len(sys.argv) == 4:
|
|
c = (int(sys.argv[1]), int(sys.argv[2]), int(sys.argv[3]))
|
|
elif len(sys.argv) == 2:
|
|
c = (int(sys.argv[1]), int(sys.argv[1]), int(sys.argv[1]))
|
|
|
|
print(f"setting color to {c}")
|
|
np.fill(c)
|
|
np.show()
|
|
except Exception as ex:
|
|
print(f"ERROR: {ex}")
|