Você está na página 1de 3

#include <avr/pgmspace.

h> //AVR library for writing to ROM


#include <Charliplexing.h> //Imports the library, which needs to
be
//Initialized in setup.
int blinkdelay = 100;

//Sets the time each frame is shown

uint16_t BitMap[][9] PROGMEM = {


//Horizontal swipe
//{1, 1, 1, 1, 1, 1, 1, 1, 1} ,
//{3, 3, 3, 3, 3, 3, 3, 3, 3},
//{7, 7, 7, 7, 7, 7, 7, 7, 7},
//{15, 15, 15, 15, 15, 15, 15, 15, 15},
//{31, 31, 31, 31, 31, 31, 31, 31, 31},
//{63, 63, 63, 63, 63, 63, 63, 63, 63},
//{127, 127, 127, 127, 127, 127, 127, 127, 127},
//{255, 255, 255, 255, 255, 255, 255, 255, 255},
//{511, 511, 511, 511, 511, 511, 511, 511, 511},
//{1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023},
//{2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047},
//{4095, 4095, 4095, 4095, 4095, 4095, 4095, 4095, 4095},
//{8191, 8191, 8191, 8191, 8191, 8191, 8191, 8191, 8191},
//{16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383,
16383},
//{16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382,
16382},
//{16380, 16380, 16380, 16380, 16380, 16380, 16380, 16380,
16380},
//{16376, 16376, 16376, 16376, 16376, 16376, 16376, 16376,
16376},
//{16368, 16368, 16368, 16368, 16368, 16368, 16368, 16368,
16368},
//{16352, 16352, 16352, 16352, 16352, 16352, 16352, 16352,
16352},
//{16320, 16320, 16320, 16320, 16320, 16320, 16320, 16320,
16320},
//{16256, 16256, 16256, 16256, 16256, 16256, 16256, 16256,
16256},
//{16128, 16128, 16128, 16128, 16128, 16128, 16128, 16128,
16128},
//{15872, 15872, 15872, 15872, 15872, 15872, 15872, 15872,
15872},
//{15360, 15360, 15360, 15360, 15360, 15360, 15360, 15360,
15360},
//{14336, 14336, 14336, 14336, 14336, 14336, 14336, 14336,
14336},
//{12288, 12288, 12288, 12288, 12288, 12288, 12288, 12288,
12288},
//{8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192},
//{0, 0, 0, 0, 0, 0, 0, 0, 0},

{1,1,0,0,0,0,0,0,0},
{3,3,0,0,0,0,0,0,0},
{7,7,0,0,0,0,0,0,0},
{15,15,0,0,0,0,0,0,0},
{31,31,0,0,0,0,0,0,0},
{63,63,0,0,0,0,0,0,0},
{127,127,0,0,0,0,0,1,1},
{255,255,0,0,0,0,0,3,3},
{511, 511, 0, 0, 0, 0, 0, 7, 7},
{1023, 1023, 0, 0, 0, 0, 0, 15, 15},
{2047, 2047, 0, 0, 0, 0, 0, 31, 31},
{4095, 4095, 0, 1, 1, 0, 0, 63, 63},
{8191, 8191, 0, 3, 3, 0, 0, 127, 127},
{16383, 16383, 0, 7, 7, 0, 0, 127, 127},
{16382, 16382, 0, 15, 15, 0, 0, 255, 255},
{16380, 16380, 0, 31, 31, 0, 0, 511, 511},
{16376, 16376, 0, 63, 63, 0, 0, 1023, 1023},
{16368, 16368, 0, 127, 127, 0, 0, 2047, 2047},
{16352, 16352, 0, 255, 255, 0, 0, 4095, 4095},
{16320, 16320, 0, 511, 511, 0, 0, 8191, 8191},
{16256, 16256, 0, 1023, 1023, 0, 0, 16383, 16383},
{16128, 16128, 0, 2047, 2047, 0, 0, 16382, 16382},
{15872, 15872, 0, 4095, 4095, 0, 0, 16380, 16380},
{15360, 15360, 0, 8191, 8191, 0, 0, 16376, 16376},
{14336, 14336, 0, 16383, 16383, 0, 0, 16368, 16368},
{12288, 12288, 0, 16382, 16382, 0, 0, 16352, 16352},
{8192, 8192, 0, 16380, 16380, 0, 0, 16320, 16320},
{0, 0, 0, 16376, 16376, 0, 0, 16256, 16256},
{0, 0, 0, 16368, 16368, 0, 0, 16128, 16128},
{0, 0, 0, 16352, 16352, 0, 0, 15872, 15872},
{0, 0, 0, 16320, 16320, 0, 0, 15360, 15360},
{0, 0, 0, 16256, 16256, 0, 0, 14336, 14336},
{0, 0, 0, 16128, 16128, 0, 0, 12288, 12288},
{0, 0, 0, 15872, 15872, 0, 0, 8192, 8192},
{0, 0, 0, 15360, 15360, 0, 0, 0, 0},
{0, 0, 0, 14336, 14336, 0, 0, 0, 0},
{0, 0, 0, 12288, 12288, 0, 0, 0, 0},
{0, 0, 0, 8192, 8192, 0, 0, 0, 0},
{18000}
};
void setup() {
LedSign::Init();
}

//Initializes the screen

void loop() {
DisplayBitMap();
}

//Displays the bitmap

void DisplayBitMap()
{
boolean run=true;
byte frame = 0;
byte line = 0;
unsigned long data;

//While this is true, the screen updates


//Frame counter
//Row counter
//Temporary storage of the row data

while(run == true) {
for(line = 0; line < 9; line++) {
//Here we fetch data from program memory with a pointer.
data = pgm_read_word_near (&BitMap[frame][line]);
//Kills the loop if the kill number is found
if (data==18000){
run=false;
}
//This is where the bit-shifting happens to pull out
//each LED from a row. If the bit is 1, then the LED
//is turned on, otherwise it is turned off.
else for (byte led=0; led<14; ++led) {
if (data & (1<<led)) {
LedSign::Set(led, line, 1);
}
else {
LedSign::Set(led, line, 0);
}
}
}

}
}

//Delays the next update


delay(blinkdelay);
frame++;

Você também pode gostar