Home Code LoL Shield – Random LEDs flashing

LoL Shield – Random LEDs flashing

by shedboy71

The LoL Shield is a charlieplexed LED matrix for the Arduino. The LEDs are individually addressable, so you can use it to display anything in a 9×14 grid. Scroll text, play games, display images, or anything else you want to do. It comes as a kit or an assembled board, teher are also various colour options and also an SMD example available.

The kit has 126 LEDs in total

random LEDs on using the LOLShield and an Arduino

 

LoL Shield

LoL Shield

Code
[c]
#include <avr/pgmspace.h>
#include <Charliplexing.h>

#define FREQ 30
//this is the LED matrix (14 by 9)
byte LOLARRAY[14][9];

//sets values
void set(int x, int y, int v)
{
LOLARRAY[x][y] = v;
LedSign::Set(x, y, v);
}

// returns random bit 0 or 1 baesd on value
int randBit()
{
int v = random(100);
return (v < FREQ) ? 1 : 0;
}

void randPattern(int lines = 9)
{
for (int i = 0; i < 14; i++)
{
for (int j = 0; j < lines; j++)
{
set(i,j,randBit());
}
}
}

void setup()
{
LedSign::Init();
randomSeed(analogRead(0));
}

void loop()
{
randPattern();
delay(1000);
}
[/c]

Links

LOL shield at Amazon UK

LOL Shiled at Amazon

Share

You may also like