I am using deshipu's driver for the HT16K33 on the Adafruit backpack for their 8x8 LED matrix. To make a smiley face, I am using the following code but I was getting a memory error when compiling. I chopped out the unused bits from deshipu's driver (which is why I added an x to the name) and the code works. My question is, is there a more memory-compact way of displaying a somewhat random matrix of individual pixels like a smiley face?
Code: Select all
from microbit import i2c, sleep
from ht16k33x import Matrix8x8
# address of HT16K33 is 0x70
display = Matrix8x8(i2c, address=0x70)
# Clear the display
display.fill(0x00)
display.show()
sleep(1000)
# display smiley face
display.pixel(2,0,1)
display.pixel(3,0,1)
display.pixel(4,0,1)
display.pixel(5,0,1)
display.pixel(1,1,1)
display.pixel(6,1,1)
display.pixel(0,2,1)
display.pixel(2,2,1)
display.pixel(5,2,1)
display.pixel(7,2,1)
display.pixel(0,3,1)
display.pixel(7,3,1)
display.pixel(0,4,1)
display.pixel(2,4,1)
display.pixel(5,4,1)
display.pixel(7,4,1)
display.pixel(0,5,1)
display.pixel(3,5,1)
display.pixel(4,5,1)
display.pixel(7,5,1)
display.pixel(1,6,1)
display.pixel(6,6,1)
display.pixel(2,7,1)
display.pixel(3,7,1)
display.pixel(4,7,1)
display.pixel(5,7,1)
display.show()
sleep (30000)
# Clear the display
display.fill(0x00)
display.show()
sleep(1000)