Matrix Portal Creature Eyes Randomized

EL Wire/Tape/Panels, LEDs, pixels and strips, LCDs and TFTs, etc products from Adafruit

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
chrisw63
 
Posts: 34
Joined: Thu Nov 07, 2013 5:39 pm

Matrix Portal Creature Eyes Randomized

Post by chrisw63 »

The Creature Eyes program for Matrix Portal is fun, but only displays one of the available Creatures. You have to change the code to show a different one. So I fixed that!

Total dirty hack, but I'm not up for clearing displayio.Group()s yet to reclaim memory - or even know enough to know whether I need to (working on it!). This hack loads all the EYE_DATA files at the same time, adding them to a list. Turns out there's plenty of memory for that. Every time the Matrix Portal resets, it chooses one at random. Next I added (here's the dirty part) a timed supervisor.reload() like this:

Code: Select all

   if NOW - SWAP > 120:
        supervisor.reload()
You see the soft reboot message for half a second while the new code starts, but getting around that would mean clearing the SPRITES... I think... so it doesn't end up with a memory error. Currently set to reload every 2 minutes (120 seconds). Just change the 120 to however many seconds you want it to wait between reloads.

The main program is attached here. You'll need the full Creatures Eyes downloaded to your Matrix Portal, then use this file to overwrite code.py (or main.py, or...). Here's the link to the Learn page: https://learn.adafruit.com/matrix-portal-creature-eyes
Attachments
CreatureEyes Random.py
Randomized Creature Eyes for last year's ADABOX MatrixPortal.
(9.25 KiB) Downloaded 3 times

Locked
Please be positive and constructive with your questions and comments.

Return to “Glowy things (LCD, LED, TFT, EL) purchased at Adafruit”