Hi I'll be showing you how to use a Raspbery Pi and an LED matrix to display some scrolling text.
Tools
This step is pretty straight forward.
After this, everything should be connected, and once you supply power to both the Pi and the matrix, you should be good to go!
Connect your PI to a monitor or a laptop and ssh in.
Then you'll need to install Python with these commands:
sudo apt-get update
sudo apt-get install python-dev python-imaging
Then download the code for driving the matrices:
wget https://github.com/adafruit/rpi-rgb-led-matrix/archive/master.zip unzip master.zip
Now you'll need to cd into the directory you just unzipped, and build the driver
cd rpi-rgb-led-matrix-master/
make
Now you can run the test demo led-matrix with this command, where D is any number from 1-9
sudo ./led-matrix -D 4
In the next step, I'll be showing you how to write your own program!
Use the following code, replacing the message with whatever you want, along with the colors for each part.
import os
from PIL import ImageFont from PIL import Image from PIL import ImageDraw text = (("Raspberry Pi ", (255, 0, 0)), ("and ", (0, 255, 0)), ("Adafruit", (0, 0, 255))) font = ImageFont.truetype("/usr/share/fonts/truetype/freefont/FreeSans.ttf", 16) all_text = "" for text_color_pair in text: t = text_color_pair[0] all_text = all_text + t print(all_text) width, ignore = font.getsize(all_text) print(width) im = Image.new("RGB", (width + 30, 16), "black") draw = ImageDraw.Draw(im) x = 0; for text_color_pair in text: t = text_color_pair[0] c = text_color_pair[1] print("t=" + t + " " + str(c) + " " + str(x)) draw.text((x, 0), t, c, font=font) x = x + font.getsize(t)[0] im.save("test.ppm") os.system("./led-matrix 1 test.ppm")