You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using your neo_16x16 code to customize neo_10x10 :
test.py
from machine import Pin
import time
from neo10x10 import neo10x10
np = neo10x10(Pin(5))
npdat=[
0x00, 0x66, 0x66, 0xe0, 0xe0, 0xe0, 0xe0, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00
]
n = 0
while 1:
np.show(npdat, n)
n = (n-10)%10
time.sleep_ms(100)
neo10x10.py
from machine import Pin
import neopixel
class neo10x10:
def __init__(self, pin):
self.np = neopixel.NeoPixel(pin, 100)
self.color = (0,0,8)
def clear(self):
self.np.fill((0,0,0))
self.np.write()
def set(self, n, color=''):
if color!='':
self.np[n] = color
else:
self.np[n] = self.color
self.np.write()
def setcolor(self, color):
self.color = color
def show(self, dat, offset=0, clear = True, color=''):
if color != '':
self.color = color
if clear:
self.np.fill((0,0,0))
num = 0
for x in range(10):
for y in range(10):
if (x+offset)>=len(dat):
self.np[x*10+y]=(0,0,0)
else:
if (1<<y)&dat[x+offset]:
if offset%2==0:
self.np[x*10 + y] = self.color
else:
self.np[x*10 + 9 - y] = self.color
self.np.write()
trying to display an image smile
I get this output
what could be the problem?
tell me in which editor to convert the image into an array of data?
The text was updated successfully, but these errors were encountered:
In neo16x16, use 1bit for a ws2812 or one byte for 8 ws2812, so 10x10 matrix need 100/8=12.5 bytes. It is not an integer and will cause some trouble.
I suggest use neo16_x16_img, it use 4bit for one of ws2812 color (to save microbit memory), and and 10x10 matrix need 100*3=300 bytes.
And I have wrote a small program microbit_toolbox to convert images, it is for microbit but with few modify it will work for other device. Or delete redundant data after convert.
Hi!
Using your neo_16x16 code to customize neo_10x10 :
test.py
neo10x10.py
trying to display an image smile
I get this output
what could be the problem?
tell me in which editor to convert the image into an array of data?
The text was updated successfully, but these errors were encountered: