.

8x8 Character Font set for NeoPixel Display matrix
import math
import random
port = "COM15"
pin = 3
pixelCount = 216
# starting arduino
arduino = Runtime.start("arduino","Arduino")
arduino.connect(port)

# starting neopixle
neopixel = Runtime.start("neopixel","NeoPixel")
neopixel.setPin(pin)
neopixel.setPixelCount(pixelCount)

# attach the two services
neopixel.attach(arduino)
neopixel.setBrightness(15)
 
def XYtoPixel(x1,y1,r,g,b): #supply x,y, and rgb colour
 x1=int(x1)
 y1=int(y1)
 z = x1 & 1       #test odd or even column
 if  z == 0 :     #Even colum
   i = 16 * (16 - (x1+1))+y1
 else :           #odd column
   i = 16 * (16 - x1) - (y1+1)  
 neopixel.setPixel(int(i),r,g,b)  

def charPlot(CC,x,y,r,g,b): # bitmap,x/y coords and colour
 for i in range(0,8):
  for j in range(0,8):
     if  (bitstream[1+(65*CC)+((i*8)+(7-j))]=="1") :
       XYtoPixel(x+j,y-i,r,g,b)
     else :
       XYtoPixel(x+j,y-i,0,0,0)  

bitstream = """
0011000001111000110011001100110011111100110011001100110000000000
1111110001100110011001100111110001100110011001101111110000000000
0011110001100110110000001100000011000000011001100011110000000000
1111100001101100011001100110011001100110011011001111100000000000
1111111001100010011010000111100001101000011000101111111000000000
1111111001100010011010000111100001101000011000001111000000000000
0011110001100110110000001100000011001110011001100011111000000000
1100110011001100110011001111110011001100110011001100110000000000
0111100000110000001100000011000000110000001100000111100000000000
0001111000001100000011000000110011001100110011000111100000000000
1110011001100110011011000111100001101100011001101110011000000000
1111000001100000011000000110000001100010011001101111111000000000
1100011011101110111111101111111011010110110001101100011000000000
1100011011100110111101101101111011001110110001101100011000000000
0011100001101100110001101100011011000110011011000011100000000000
1111110001100110011001100111110001100000011000001111000000000000
0111100011001100110011001100110011011100011110000001110000000000
1111110001100110011001100111110001101100011001101110011000000000
0111100011001100111000000111000000011100110011000111100000000000
1111110010110100001100000011000000110000001100000111100000000000
1100110011001100110011001100110011001100110011001111110000000000
1100110011001100110011001100110011001100011110000011000000000000
1100011011000110110001101101011011111110111011101100011000000000
1100011011000110011011000011100000111000011011001100011000000000
1100110011001100110011000111100000110000001100000111100000000000
1111111011000110100011000001100000110010011001101111111000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000011110000000110001111100110011000111011000000000
1110000001100000011000000111110001100110011001101101110000000000
0000000000000000011110001100110011000000110011000111100000000000
0001110000001100000011000111110011001100110011000111011000000000
0000000000000000011110001100110011111100110000000111100000000000
0011100001101100011000001111000001100000011000001111000000000000
0000000000000000011101101100110011001100011111000000110011111000
1110000001100000011011000111011001100110011001101110011000000000
0011000000000000011100000011000000110000001100000111100000000000
0000110000000000000011000000110000001100110011001100110001111000
1110000001100000011001100110110001111000011011001110011000000000
0111000000110000001100000011000000110000001100000111100000000000
0000000000000000110011001111111011111110110101101100011000000000
0000000000000000111110001100110011001100110011001100110000000000
0000000000000000011110001100110011001100110011000111100000000000
0000000000000000110111000110011001100110011111000110000011110000
0000000000000000011101101100110011001100011111000000110000011110
0000000000000000110111000111011001100110011000001111000000000000
0000000000000000011111001100000001111000000011001111100000000000
0001000000110000011111000011000000110000001101000001100000000000
0000000000000000110011001100110011001100110011000111011000000000
0000000000000000110011001100110011001100011110000011000000000000
0000000000000000110001101101011011111110111111100110110000000000
0000000000000000110001100110110000111000011011001100011000000000
0000000000000000110011001100110011001100011111000000110011111000
0000000000000000111111001001100000110000011001001111110000000000
"""
for bb in range(1,53):
  charPlot(bb,4,15,255,255,255)

print("finish")
 

 

GroG

2 years 1 month ago

Awesome Gareth, as all your work is !
perhaps there should be a default char set as part of neopixel ... hmmm
Initially it was my intention to have a pixel matrix  .. but then i realized alot of what i wanted to show would need to be scrolled, and then i found out the flex one i got could wrap around a ABS sewer pie cover.

I wonder how ledgible scrolling text would be ... hmmm...

Well calculated with the Top Hat.... I will try out some scrolling code.

Having used the Neopixel service, It needs speeding up (currently 1 second for 8x8 character), as far as I can see there is no pre-buffer for you to set your matrix pattern and then flash it into view (or did i miss something). current python code sends indiviual pixels which are slow over the MRLCOMM pipeline.

A slight faster approach to current Python code might be clear the screen (as that is build into the Service) and then just plot only "on" state LEDs.... (i.e. why plot a black led.)

....Yes inbuild Charater-set would be the fastest way to go, I dont think there will be much of overhead on the memory side of things.