Change to the directory using the command:
$ cd ~/display16x32/rpi-rgb-led-matrix
$ nano led-matrix.h
int width() const { return 96; }
enum { kDoubleRows = 8, // Physical constant of the used board. kChainedBoards = 3, // Number of boards that are daisy-chained. kColumns = kChainedBoards * 32, kPWMBits = 4 // maximum PWM resolution. };
$ sudo ./led-matrix
$ sudo ./led-matrix 1 runtext.ppm
$ sudo apt-get update $ sudo apt-get install python-imaging
$ nano message.py
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")
You can change the message and its use of colors by editing the variable "text". This contains a collection of entries, each in the form of a piece of text followed by the color for that text.
("Raspberry Pi ", (255, 0, 0))
Although this example has three sections of differently colored text, you can add as many as you like, to create longer messages.