I’m playing with the UnicornHAT on a Pi 2, after having installed the software via the full install command, and I’ve found the
set_all() method doesn’t exist.
I checked the source on GitHub, and it’s there, but checking the same file on my Pi, and it’s missing.
Most of the other functions work, and I’m able to get the same effect using the following code, but I doubt this is very efficient:
width, height = unicorn.get_shape()
for y in range(height):
for x in range(width):
unicorn.set_pixel(x, y, rgb['red'], rgb['green'], rgb['blue'])
This leads me to think I’ve maybe done something wrong, or the version installed via pip is old. I tried updating the package manually, but that didn’t work either.
I’m pretty new to python, so it’s totally possible that I’m doing something wrong, but I don’t know what.
Download the pimoroni dashboard (sudo apt-get pimoroni)
When installed launch the application through the start menu under the start menu
Select my product is a hat and then unicorn hat
If the problem still isn’t fixed try the update all pi fairies option you see when you launch the pimoroni dashboard
I’m running the pi headless, so I’m not going to be able to run this dashboard you mention.
OK, so I’ve found that you can run the dashboard from the command line via
pimoroni-dashboard, so I installed it, run the command, and after exploring the various options (both choosing to install the UnicornHAT, and also checking for updates to the installed libraries), discovered that it’s not doing anything that I’ve not already tried manually.
I think the issue is the version of the library available on pip is out of date.
Unicorn HAT - set_all method not working gives an alternative. @gadgetoid might be able to confirm if the pip version was ever updated.
My apologies, I did try searching for an answer before posting (although admittedly, that was in the GitHub Issues for the repo, not on the forum).
As long as it’s known about, then I’m happy. Thank you.
yes, the installers specifically use the lib considered ‘stable’ i.e available via pip (or apt-get where the case may be), and copies examples to correspond to the point in time that release was made.
That means that you may not have the latest state of the library, and you may be missing some of the additional examples contributed in recent times. The benefit however is that that combination is normally trusted to be working together.
You can install the development version of the library using the
setuptools method, but as well as getting potentially some fixes and new functionality, you may also get some bugs (probably hard to track if we did not ran into them with a first pass review).
… all that to say, as long as you know the pitfalls, you can go ahead and use the repo version - after all we do need people to give it a spin at some point - but do keep in mind that you may end up with more trouble, not fewer :)
I was hoping to push a new version up alongside a new rpi_ws281x library that isn’t a hard-forked hack of https://github.com/jgarff/rpi_ws281x but since that repository seems to be neglected at times- it’s had a pending merge from me for Pi Zero W support for 12 days- I might just make a more traditional fork with our own ongoing tweaks/maintenance and release against that.
That said, there may be another option in the pipeline- anyway such shenanigans have left the Unicorn HAT library a little up in the air, and nobody really cares about the plumbing 'til it breaks. It looks like I should release a new version in the interim.
I have pushed up a new version - 2.1.3 - with
set_all and a handful of other changes that have occurred in the 8 months since the last release.
I’ll update and see what happens. Thanks, everyone :)
EDIT: not much to add, except to say I’ve run the update, and
set_all() appears to be working perfectly.