After I wrote my Xmas Tree code for the Unicorn Hat I felt like I needed to also be able to display a festive message. Although it is quite narrow, I reckoned a text scrolling app would work quite well on the Unicorn Hat if I kept the character size slightly smaller than full-screen(grid?).
I decided to fix most characters to 6x4 pixels (with the exception of those fatties M and W) which allows for portions of 2 characters on the screen simultaneously.
I've stuck the various Python files up on GitHub. In includes a test script which produces this output:
Anyway, my son liked it and wrote a program to create a random 5 letter word and display it in a random colour:
He likes doing stuff with the Python random module at the moment...from UHScroll import*import random import string
bill=['red','white','pink','blue','green','cyan']
def wordpick(): qwerty = '' for q in range(5): bob=random.choice(string.letters) qwerty = qwerty + bob return qwerty
for w in range(5): dad=wordpick() print dad unicorn_scroll(dad,random.choice(bill),254,0.5)
This comment has been removed by the author.
ReplyDeleteWhen I enter sudo ./test.py I've got a command not found in Terminal. I'm a noob I'll admit but how do I start the program, since it's not the same way as the pimoroni examples.
ReplyDeleteWhen I enter sudo ./test.py I've got a command not found in Terminal. I'm a noob I'll admit but how do I start the program, since it's not the same way as the pimoroni examples.
ReplyDeleteI think you should enter "python test.py" to run it...
DeleteThis is a lovely thing, which I would like to use on my UnicornhatHD. I've managed to get it to run using a quarter of the display, but cannot see how to make it use the full width of the display, for the life of me. It's five years old - can you remember what would need changing?
ReplyDeleteI did find out how to do it, but forgot to say so...
Deletehttps://www.blogger.com/blog/post/edit/19190782/7770159591643869664
The Unicorn HAT provides a compact and colourful way to display scrolling messages on your Raspberry Pi.
ReplyDeleteRazorSQL Crack