0

I have an LED panel on beaglebone (30*50 pixels) and I can on every pixel set RGB value, like

setpixel(x,y,RGB)

and I'd like to draw letters on it, but I don't know, where to start. Something like save every letter in 2D array and then draw it on panel? But it will be one array for every letter. Do you have any ideas? Thanks.

parman
  • 127
  • 1
  • 3
  • 11
  • 2
    _"Something like save every letter in 2D array and then draw it on panel?"_ Sounds like a reasonable approach. Let us know if you have any specific problems implementing it :-) – Kevin Feb 04 '15 at 13:21
  • See [Is there a python library that allows to easily print ascii-art text?](http://stackoverflow.com/questions/9632995/is-there-a-python-library-that-allows-to-easily-print-ascii-art-text) (particularly the answer using `PIL`) – Lukas Graf Feb 04 '15 at 13:22

1 Answers1

1

You could for example draw a bitmap representing your letter. Just use your favorite drawing program and create yourself a new file with the desired dimensions (for example 12x12 pixels) and then draw with a black pencil what you want to have and save it as a greyscale BMP (called myletter.bmp in the example below).

Then to get this in python, try this little demo:

from PIL import Image
my_bmp = Image.open('myletter.bmp')
data = my_bmp.getdata()
for i,p in enumerate(data):
    if i % my_bmp.size[0] ==0:
        print
    print '%3d'%p,

This will just print the data according to your drawing to the stdout.

But of course you can use the exact same data to draw to your display, when setting the positions and RGB according to your data. Happy hacking:)

Salo
  • 1,936
  • 15
  • 24