So far no luck. My setup is two 64 wide by 32 high Hub 75 panels for a combined 128 x 32 matrix. Here is what I have tried so far.
import time
import random
#from cosmic import CosmicUnicorn
#from picographics import PicoGraphics, DISPLAY_COSMIC_UNICORN as DISPLAY
from interstate75 import Interstate75
#gu = CosmicUnicorn()
#graphics = PicoGraphics(DISPLAY)
i75 = Interstate75(display=Interstate75.DISPLAY_INTERSTATE75_128X32, stb_invert=True)
graphics = i75.display
width = 128
height = 32
colour = (230, 150, 0)
@micropython.native # noqa: F821
def setup():
global width, height, lifetime, age
#width = CosmicUnicorn.WIDTH
#height = CosmicUnicorn.HEIGHT
width = 128
height = 32
lifetime = [[0.0 for y in range(height)] for x in range(width)]
age = [[0.0 for y in range(height)] for x in range(width)]
for y in range(height):
for x in range(width):
lifetime[x][y] = 1.0 + random.uniform(0.0, 0.1)
age[x][y] = random.uniform(0.0, 1.0) * lifetime[x][y]
@micropython.native # noqa: F821
def draw():
for y in range(height):
for x in range(width):
if age[x][y] < lifetime[x][y] * 0.3:
graphics.set_pen(graphics.create_pen(colour[0], colour[1], colour[2]))
elif age[x][y] < lifetime[x][y] * 0.5:
decay = (lifetime[x][y] * 0.5 - age[x][y]) * 5.0
graphics.set_pen(graphics.create_pen(int(decay * colour[0]), int(decay * colour[1]), int(decay * colour[2])))
else:
graphics.set_pen(0)
graphics.pixel(x, y)
#gu.update(graphics)
i75.update(graphics)
@micropython.native # noqa: F821
def update():
for y in range(height):
for x in range(width):
if age[x][y] >= lifetime[x][y]:
age[x][y] = 0.0
lifetime[x][y] = 1.0 + random.uniform(0.0, 0.1)
age[x][y] += 0.025
setup()
#gu.set_brightness(0.5)
while True:
#if gu.is_pressed(CosmicUnicorn.SWITCH_BRIGHTNESS_UP):
#gu.adjust_brightness(+0.01)
#if gu.is_pressed(CosmicUnicorn.SWITCH_BRIGHTNESS_DOWN):
#gu.adjust_brightness(-0.01)
start = time.ticks_ms()
draw()
update()
# pause for a moment (important or the USB serial device will fail)
time.sleep(0.001)
print("total took: {} ms".format(time.ticks_ms() - start))
This gets me the following error.
>>> %Run -c $EDITOR_CONTENT
Traceback (most recent call last):
File "<stdin>", line 72, in <module>
MemoryError:
PROBLEM IN THONNY'S BACK-END: Exception while handling 'Run' (thonny.plugins.micropython.mp_back.ManagementError: Command output was not empty).
See Thonny's backend.log for more info.
You may need to press "Stop/Restart" or hard-reset your MicroPython device and try again.
Process ended with exit code 1.
I’m guessing you’re running out of memory for those lifetime / age arrays; you’re trying to wrangle almost four time the pixels (2048, up from 583 on the Galactic Unicorn) and blowing the Pico’s stack.
That’s the same number of LED’s that I have. My panels are actually arranged in a 64 x 64 configuration. I have to run them in 128 x 32 though. I’m not saying your wrong, just adding the info for clarity.
I got it running at 64 x 32. It just duplicates on both matrixes. I know it can be done now.
import time
import random
#from interstate75 import Interstate75, SWITCH_A, SWITCH_B
from interstate75 import Interstate75, DISPLAY_INTERSTATE75_64X32
i75 = Interstate75(display=DISPLAY_INTERSTATE75_64X32)
graphics = i75.display
i75.set_led(255, 0, 0)
width = 64
height = 32
BLACK = graphics.create_pen(0, 0, 0)
graphics.set_pen(BLACK)
graphics.clear()
i75.update(graphics)
colour = (255, 0, 0)
@micropython.native # noqa: F821
def setup():
global width, height, lifetime, age
width = 64
height = 32
lifetime = [[0.0 for y in range(height)] for x in range(width)]
age = [[0.0 for y in range(height)] for x in range(width)]
for y in range(height):
for x in range(width):
lifetime[x][y] = 1.0 + random.uniform(0.0, 0.1)
age[x][y] = random.uniform(0.0, 1.0) * lifetime[x][y]
@micropython.native # noqa: F821
def draw():
for y in range(height):
for x in range(width):
if age[x][y] < lifetime[x][y] * 0.3:
graphics.set_pen(graphics.create_pen(colour[0], colour[1], colour[2]))
elif age[x][y] < lifetime[x][y] * 0.5:
decay = (lifetime[x][y] * 0.5 - age[x][y]) * 5.0
graphics.set_pen(graphics.create_pen(int(decay * colour[0]), int(decay * colour[1]), int(decay * colour[2])))
else:
graphics.set_pen(0)
graphics.pixel(x, y)
i75.update(graphics)
@micropython.native # noqa: F821
def update():
for y in range(height):
for x in range(width):
if age[x][y] >= lifetime[x][y]:
age[x][y] = 0.0
lifetime[x][y] = 1.0 + random.uniform(0.0, 0.1)
age[x][y] += 0.025
setup()
#gu.set_brightness(0.5)
while True:
#if i75.switch_pressed(SWITCH_A):
#i75.set_led(255, 0, 0)
#if i75.switch_pressed(SWITCH_B):
#i75.set_led(0, 255, 0)
start = time.ticks_ms()
draw()
update()
# pause for a moment (important or the USB serial device will fail)
time.sleep(0.001)
print("total took: {} ms".format(time.ticks_ms() - start))
EDIT: That didn’t work as planned. The PICO W uf2 I found doesn’t have ulab in it. The Galactic Unicorn uf2 does, but doesn’t have the Hub 75 stuff in it.
I have the 80’s super computer with sound numby version running on my GU though.