ws2812/heart.py

33 lines
2.7 KiB
Python
Raw Normal View History

2023-04-20 23:27:17 +00:00
from ws2812b import WS2812B
import time
ws = WS2812B(256, 28, 0.2)
2023-04-20 23:42:29 +00:00
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],
]
2023-04-20 23:27:17 +00:00
2023-04-20 23:42:29 +00:00
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])
2023-04-20 23:27:17 +00:00
ws.pixels_show()