Skip to content

Instantly share code, notes, and snippets.

@ali1234
Created February 27, 2018 16:50
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 ali1234/0bbcc58f5288c8fc43440aa44ad1cb51 to your computer and use it in GitHub Desktop.
Save ali1234/0bbcc58f5288c8fc43440aa44ad1cb51 to your computer and use it in GitHub Desktop.
#!/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