ws2812/heart.py

33 lines
2.7 KiB
Python

from ws2812b import WS2812B
import time
ws = WS2812B(256, 28, 0.2)
array = [
[ws.RED, ws.BLACK, ws.BLACK, ws.BLACK, ws.RED, ws.BLACK, ws.BLACK, ws.BLACK, ws.RED, ws.BLACK, ws.BLACK, ws.BLACK, ws.RED, ws.BLACK, ws.BLACK, ws.BLACK],
[ws.RED, ws.BLACK, ws.BLACK, ws.BLACK, ws.RED, ws.BLACK, ws.BLACK, ws.BLACK, ws.RED, ws.BLACK, ws.BLACK, ws.BLACK, ws.RED, ws.BLACK, ws.BLACK, ws.BLACK],
[ws.RED, ws.BLACK, ws.BLACK, ws.BLACK, ws.RED, ws.BLACK, ws.BLACK, ws.BLACK, ws.RED, ws.BLACK, ws.BLACK, ws.BLACK, ws.RED, ws.BLACK, ws.BLACK, ws.BLACK],
[ws.RED, ws.BLACK, ws.BLACK, ws.BLACK, ws.RED, ws.BLACK, ws.BLACK, ws.BLACK, ws.RED, ws.BLACK, ws.BLACK, ws.BLACK, ws.RED, ws.BLACK, ws.BLACK, ws.BLACK],
[ws.RED, ws.BLACK, ws.BLACK, ws.BLACK, ws.RED, ws.BLACK, ws.BLACK, ws.BLACK, ws.RED, ws.BLACK, ws.BLACK, ws.BLACK, ws.RED, ws.BLACK, ws.BLACK, ws.BLACK],
[ws.RED, ws.BLACK, ws.BLACK, ws.BLACK, ws.RED, ws.BLACK, ws.BLACK, ws.BLACK, ws.RED, ws.BLACK, ws.BLACK, ws.BLACK, ws.RED, ws.BLACK, ws.BLACK, ws.BLACK],
[ws.RED, ws.BLACK, ws.BLACK, ws.BLACK, ws.RED, ws.BLACK, ws.BLACK, ws.BLACK, ws.RED, ws.BLACK, ws.BLACK, ws.BLACK, ws.RED, ws.BLACK, ws.BLACK, ws.BLACK],
[ws.RED, ws.BLACK, ws.BLACK, ws.BLACK, ws.RED, ws.BLACK, ws.BLACK, ws.BLACK, ws.RED, ws.BLACK, ws.BLACK, ws.BLACK, ws.RED, ws.BLACK, ws.BLACK, ws.BLACK],
[ws.RED, ws.BLACK, ws.BLACK, ws.BLACK, ws.RED, ws.BLACK, ws.BLACK, ws.BLACK, ws.RED, ws.BLACK, ws.BLACK, ws.BLACK, ws.RED, ws.BLACK, ws.BLACK, ws.BLACK],
[ws.RED, ws.BLACK, ws.BLACK, ws.BLACK, ws.RED, ws.BLACK, ws.BLACK, ws.BLACK, ws.RED, ws.BLACK, ws.BLACK, ws.BLACK, ws.RED, ws.BLACK, ws.BLACK, ws.BLACK],
[ws.RED, ws.BLACK, ws.BLACK, ws.BLACK, ws.RED, ws.BLACK, ws.BLACK, ws.BLACK, ws.RED, ws.BLACK, ws.BLACK, ws.BLACK, ws.RED, ws.BLACK, ws.BLACK, ws.BLACK],
[ws.RED, ws.BLACK, ws.BLACK, ws.BLACK, ws.RED, ws.BLACK, ws.BLACK, ws.BLACK, ws.RED, ws.BLACK, ws.BLACK, ws.BLACK, ws.RED, ws.BLACK, ws.BLACK, ws.BLACK],
[ws.RED, ws.BLACK, ws.BLACK, ws.BLACK, ws.RED, ws.BLACK, ws.BLACK, ws.BLACK, ws.RED, ws.BLACK, ws.BLACK, ws.BLACK, ws.RED, ws.BLACK, ws.BLACK, ws.BLACK],
[ws.RED, ws.BLACK, ws.BLACK, ws.BLACK, ws.RED, ws.BLACK, ws.BLACK, ws.BLACK, ws.RED, ws.BLACK, ws.BLACK, ws.BLACK, ws.RED, ws.BLACK, ws.BLACK, ws.BLACK],
[ws.RED, ws.BLACK, ws.BLACK, ws.BLACK, ws.RED, ws.BLACK, ws.BLACK, ws.BLACK, ws.RED, ws.BLACK, ws.BLACK, ws.BLACK, ws.RED, ws.BLACK, ws.BLACK, ws.BLACK],
[ws.RED, ws.BLACK, ws.BLACK, ws.BLACK, ws.RED, ws.BLACK, ws.BLACK, ws.BLACK, ws.RED, ws.BLACK, ws.BLACK, ws.BLACK, ws.RED, ws.BLACK, ws.BLACK, ws.BLACK],
]
for i in range(16):
if i % 2 == 1:
array[i] = array[i][::-1]
array = [elem for row in array for elem in row]
for i in range(256):
ws.pixels_set(i, array[i])
ws.pixels_show()