Created
February 27, 2018 16:50
-
-
Save ali1234/0bbcc58f5288c8fc43440aa44ad1cb51 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import unicornhathd | |
import datetime | |
import numpy as np | |
print("""Unicorn HAT HD: Rainbow | |
OMG MY EYES. | |
Press Ctrl+C to exit! | |
""") | |
unicorn = unicornhathd | |
unicorn.rotation(270) | |
step = 0 | |
try: | |
while True: | |
d = datetime.datetime.now() | |
timearray = np.array([d.microsecond/10, d.second, d.minute, d.hour, d.day, d.month, d.year-2000], dtype=np.uint8) | |
bitarray = np.unpackbits(timearray, axis=0)[::-1].reshape(-1,8) | |
unicorn._buf[1:8,0:8,0] = bitarray*255 | |
unicorn.show() | |
except KeyboardInterrupt: | |
unicorn.off() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment