LoL Shield

Got a green LoL shield using part of the $80 I won from SparkFun’s Free Day (The rest was used on an Ethernet shield, a solder vacuum, another touchscreen breakout board, and breakaway female headers).

Soldering it took forever (three hours) because I am terrible at soldering. In the end, things weren’t soldered so well so some of the LEDs weren’t lighting up (two of the columns didn’t light up because of a single badly-done solder joint), so I had to do a lot of checking. I also burned out one of the LEDs; thankfully they included 8 extra LEDs, probably for such things. The solder vacuum helped a lot more than I thought it would; it’s way better than the desoldering bulb I was using.

Anyway this thing is pretty cool; I downloaded ikkei‘s version of the LoL shield library, and it seems to be a lot better with not having LEDs light up as much when they’re not supposed to be lit. I also modified the scrolling text program to make it more customizable, hopefully (the original code had hardcoded numbers inside the loops, and it wasn’t immediately clear what they were for).

/*
  Requires LoL Shield library, at least V0.2Beta 
  http://code.google.com/p/lolshield/downloads/list

  And the Font.cpp from LoL_Shield-100915.zip on ikkei's page:
  http://web.mac.com/kxm_ikkei/Site/LoL.html

  Based on original TEXT SAMPLE CODE for LOL Shield for Arduino
  Copyright 2009/2010 Benjamin Sonntag  http://benjamin.sonntag.fr/
  
  (This version edited by Walfas)
*/

#include "Charliplexing.h"
#include "Font.h"
#include "WProgram.h"

// Technically the number of columns of LEDs minus one
#define SCREEN_WIDTH 13

// Scroll delay: lower values result in faster scrolling
#define SCROLL_DELAY 80 

/* How long to wait after the last letter before
    going back to the beginning and repeating */
#define REPEAT_DELAY 500

int textLength, totalPixels;
char text[]="Aw yeah, this thing is pretty awesome!";

void setup() {
  LedSign::Init();
  getLength(text, &textLength, &totalPixels);
}

void loop() {
  int x=0;
  for(int j=SCREEN_WIDTH; j>-totalPixels-SCREEN_WIDTH; j--) {
    x=j;
    LedSign::Clear();
    for(int i=0; i=SCREEN_WIDTH) 
        break;
    }
    delay(SCROLL_DELAY);
  }
  delay(REPEAT_DELAY);
}

void getLength(char* charArray, int* lengthPtr, int* pixelPtr) {
  /* Finds the length of a string in terms of characters
     and pixels and assigns them to the variable at 
     addresses lengthPtr and pixelPtr, respectively. */
      
  int charCount = 0, pixelCount = 0;
  char * charPtr = charArray;
  
  // Count chars until newline or null character reached
  while (*charPtr != '¥0' && *charPtr != '¥n') {
    charPtr++;
    charCount++;
    
    /* Increment pixelCount by the number of pixels 
       the current character takes up horizontally. */
    pixelCount += Font::Draw(*charPtr,-SCREEN_WIDTH,0);
  }

  *pixelPtr = pixelCount;
  *lengthPtr = charCount;
}

One thought on “LoL Shield

Comments are closed.