Thursday, September 16, 2010

LoL news scrolling thingy

I recently attended the Mitch Altman/Jimmie Rodgers soldering workshop at Bloominglabs here in town. Both Jimmie and Mitch brought kits to sell, and I bought one of Altman's famous brain machines, and Jimmie's LoL Shield (lots of LEDs, lots of lights, lots of laffs) in the then brand-new extra bright blue.

Once I'd put it together I had to do something with it other than the test pattern and the game of life. There is a pretty nice implementation of Tetris for it - you can use a potentiometer as a paddle to move left and right, and a button to rotate it.

Anyhow, I wanted it to display scrolling messages, and not the hardcoded kind. To that end I first obtained this nice library: guyzmo's LoL shield dynamic banner. If you want to use it, you have to pull the other Charlieplexing.h and .cpp files out of your library files, b/c otherwise you'll have a conflict.

This pretty much reads whatever comes in via serial port over the USB cable connecting yr Arduino to yr computer, and then scrolls the message on the display. This could be adapted to be either wireless or over the internet. Go nuts.

W/ version 1 of this, I noticed weirdness with only getting the latter half of a string when a headline changed. After futzing around, it seemed to be due to a need to 're-init' on the change. So I changed this function in the LolGlyph.cpp file like so (there may be a better way to achieve this end):
void UpdateTextFromSerial() {
int i=0;
char c;
while (Serial.available() > 0 && i < 140) {
c =;
disp[i++] = c;
if (i != 0) {
disp_len = strlen(disp)*6;
disp[i] = '\0';

ScrollLeft_setup(); // this is what I added - SDC


Aside from this, I use the dispfont.pde file in guyzmo's code pretty much as is.

On the computer side, I used the New York Times API, because it's a nice API. If the New York Times is too liberal for you, there are many other ways you could get headlines: scrape RSS feeds, use a different API, whatever.

This piece is really simple. It's in Python, so obviously you will need that.

First file is for grabbing the headlines (

Second file uses the first and communicates w/ the Arduino via pySerial. You may have to install pySerial. It's been a while.

Have fun, and this stuff falls under the WTFPL (as does the original), so do whatever the fuck you want with it.

Here's the exciting git-hub location for this. No guarantees or warantees are explicit or implied. Or however that goes.

1 comment:

AskAMassivePro said...
This comment has been removed by a blog administrator.