alguÉm sabe de um sketch para arduino leonardo de matrix led 30x8

Galera estou procurando alguém que fraga o código do Arduino para animação de texto para um painel de led de Matrix de led 30x8 com micro controlador MAX7219.
Eu consegui um código só não sei de vai funcionar na matrix 30x8 que quero, e ta dando erro na aba “animation.h” mostra que “uint8_t animation[][16] = {” ta errado.

S e alguém fraga o código me da um help.

################### aba: Led Matrix Shifted

.#include <TimerOne.h>

.#include “Shifting.h”
.#include “animation.h”

.#define PWM_LEVELS 4

int clockPin = 2;
int latchPin = 4;
int dataPin = 8;

int timerDelay = 1400;
byte pwmCounter = 0;
byte brightnesses[64];

void iProcess() {
int rowOn, colsOn, c;
for(int r=0; r<8; ++r) {
rowOn = ~(1<<r);
colsOn = 0;
for(c=0; c<8; ++c) {
colsOn |= (pwmCounter < brightnesses[r * 8 + c])<<c;
}

shiftOutByte(dataPin, clockPin, MSBFIRST, rowOn);
shiftOutByte(dataPin, clockPin, MSBFIRST, colsOn);
bitOut(latchPin, LOW);
bitOut(latchPin, HIGH);

if(++pwmCounter > PWM_LEVELS) pwmCounter = 0;

}
}

void setup() {
pinMode(clockPin, OUTPUT);
pinMode(latchPin, OUTPUT);
pinMode(dataPin, OUTPUT);

Timer1.initialize(timerDelay);
Timer1.attachInterrupt(iProcess);
}

unsigned long nextImage = 0;
int animationIndex = -1;

void loop() {
if(millis() > nextImage) {
if(++animationIndex >= animationFrames) animationIndex = 0;
nextImage = millis() + animationDelays[animationIndex];
for(int i=0; i<(88); ++i) {
brightnesses[i] = (animation[animationIndex][i/4] >> (i%4
2)) & B00000011;
}
}
}

################### Aba: Shifiting
.#ifndef SHIFTING_H
.#define SHIFTING_H

.#define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit))
.#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))

.#define sbipin(pin) sbi((pin)<8 ? PORTD:PORTB, (pin) - ((pin)<8 ? 0:8))
.#define cbipin(pin) cbi((pin)<8 ? PORTD:PORTB, (pin) - ((pin)<8 ? 0:8))

.#define bitOut(pin, val) {
if ((val) == LOW) cbipin(pin);
else sbipin(pin);
}

.#define shiftOutBit(dataPin, clockPin, val, bit) {
bitOut(dataPin, ((val) & (1 << (bit))) ? HIGH:LOW);
bitOut(clockPin, HIGH);
bitOut(clockPin, LOW);
}

.#define shiftOutByte(dataPin, clockPin, bitOrder, val) {
shiftOutBit(dataPin, clockPin, val, (bitOrder) == LSBFIRST ?0:7);
shiftOutBit(dataPin, clockPin, val, (bitOrder) == LSBFIRST ?1:6);
shiftOutBit(dataPin, clockPin, val, (bitOrder) == LSBFIRST ?2:5);
shiftOutBit(dataPin, clockPin, val, (bitOrder) == LSBFIRST ?3:4);
shiftOutBit(dataPin, clockPin, val, (bitOrder) == LSBFIRST ?4:3);
shiftOutBit(dataPin, clockPin, val, (bitOrder) == LSBFIRST ?5:2);
shiftOutBit(dataPin, clockPin, val, (bitOrder) == LSBFIRST ?6:1);
shiftOutBit(dataPin, clockPin, val, (bitOrder) == LSBFIRST ?7:0);
}

.#endif

################### Aba: Animation
int animationFrames = 28;

int animationDelays[] = { 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 2000 };

// Animation is designed for 8x8 pixels
uint8_t animation[][16] = {
{ 0x3, 0x0, 0x3, 0x0, 0x3, 0x0, 0x3, 0x0, 0x3, 0x0, 0x3, 0x0, 0x3, 0x0, 0x3, 0x0 },
{ 0xf, 0x0, 0xf, 0x0, 0xf, 0x0, 0xf, 0x0, 0xf, 0x0, 0xf, 0x0, 0xf, 0x0, 0xf, 0x0 },
{ 0x3f, 0x0, 0x3f, 0x0, 0x3f, 0x0, 0x3f, 0x0, 0x3f, 0x0, 0x3f, 0x0, 0x3f, 0x0, 0x3f, 0x0 },
{ 0xff, 0x0, 0xff, 0x0, 0xff, 0x0, 0xff, 0x0, 0xff, 0x0, 0xff, 0x0, 0xff, 0x0, 0xff, 0x0 },
{ 0xff, 0x3, 0xff, 0x3, 0xff, 0x3, 0xff, 0x3, 0xff, 0x3, 0xff, 0x3, 0xff, 0x3, 0xff, 0x3 },
{ 0xff, 0xf, 0xff, 0xf, 0xff, 0xf, 0xff, 0xf, 0xff, 0xf, 0xff, 0xf, 0xff, 0xf, 0xff, 0xf },
{ 0xff, 0x3f, 0xff, 0x3f, 0xff, 0x3f, 0xff, 0x3f, 0xff, 0x3f, 0xff, 0x3f, 0xff, 0x3f, 0xff, 0x3f },
{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff },
{ 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa },
{ 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55 },
{ 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x45, 0x51 },
{ 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x45, 0x51, 0x0, 0x0 },
{ 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x45, 0x51, 0x0, 0x0, 0x0, 0x0 },
{ 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x45, 0x51, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 },
{ 0x55, 0x55, 0x55, 0x55, 0x45, 0x51, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 },
{ 0x55, 0x55, 0x45, 0x51, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 },
{ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 },
{ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x40, 0x0 },
{ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x40, 0x0, 0x40, 0x0, 0x40, 0x0 },
{ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x80, 0x0, 0x80, 0x0, 0x40, 0x0, 0x40, 0x0, 0x0, 0x0 },
{ 0x0, 0x0, 0x0, 0x0, 0xc0, 0x0, 0x80, 0x0, 0x80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 },
{ 0x0, 0x0, 0x0, 0x0, 0xc0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 },
{ 0x0, 0x0, 0xc0, 0x0, 0xf0, 0x3, 0xc0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 },
{ 0xc0, 0x0, 0x10, 0x1, 0xcc, 0xc, 0x10, 0x1, 0xc0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 },
{ 0x60, 0x2, 0x8, 0x8, 0x4, 0x4, 0x8, 0x8, 0x60, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 },
{ 0x4, 0x4, 0x1, 0x10, 0x0, 0x0, 0x1, 0x10, 0x4, 0x4, 0x10, 0x1, 0x0, 0x0, 0x0, 0x0 },
{ 0x1, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x10, 0x0, 0x0, 0x0, 0x0 },
{ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }
};

[...] shiftOutByte(dataPin, clockPin, MSBFIRST, rowOn); shiftOutByte(dataPin, clockPin, MSBFIRST, colsOn); [...] pinMode(clockPin, OUTPUT); pinMode(latchPin, OUTPUT); pinMode(dataPin, OUTPUT); [...]
Essa parte do código aqui é um clássico de ShiftOut e é necessário um (na verdade se tratando de um array, um chaining de) CI’s de Shift Register (74HC595 ou variante) para que isto funcione a contento, leitura necessária é essa: http://arduino.cc/en/tutorial/ShiftOut

Eu particularmente acho que é mais inteligente trabalhar isso com um BCD Decoder, mas tem gente que adora essas gambiarras… enfim…

Excelente Skasdutra… na verdade estou precisando de um comando animado para 4 mensagem com letras e caracteres que aparecem uma atrás da outra com animações sequenciais…
01- Um com texto em movimento
02 - Um com texto que surge como flash, uma vez e sai com efeito flash.
03 - Um com texto que surge como flash, uma vez e sai com efeito flash.
04 - Um que aparece a iluminação completa da grade de led de cima para baixo fica por 30 sec e sai.

TENHO ESSE SKETCH PRIMÁRIO COMO MODELO. Se vc poder me ajudar, dar alguma dica agradeço.

---------------------- SKETCK MATRIX MAX72XX ----------------------

// Programa : Painel de leds com modulo Max7219
// Adaptacoes e comentarios : Arduino e Cia

// Carrega a biblioteca MD_MAX72xx
#include <MD_MAX72xx.h>

// Numero de modulos utilizados
.#define MAX_DEVICES 4

// Ligacoes ao Arduino
.#define DATA_PIN 4
.#define CS_PIN 5
.#define CLK_PIN 6

MD_MAX72XX mx = MD_MAX72XX(DATA_PIN, CLK_PIN, CS_PIN, MAX_DEVICES);

// Velocidade do scroll
.#define SCROLL_DELAY 100
// Colunas entre cada caracter
.#define CHAR_SPACING 1

.#define BUF_SIZE 75
char curMessage[BUF_SIZE];
char newMessage[BUF_SIZE];

// int scrollDelay;

uint8_t scrollDataSource(uint8_t dev, MD_MAX72XX::transformType_t t)
{
static char *p = curMessage;
static uint8_t state = 0;
static uint8_t curLen, showLen;
static uint8_t cBuf[8];
uint8_t colData;

switch(state)
{
case 0:
showLen = mx.getChar(*p++, sizeof(cBuf)/sizeof(cBuf[0]), cBuf);
curLen = 0;
state++;
if (*p == ‘\0’)
{
p = curMessage;
}
case 1:
colData = cBuf[curLen++];
if (curLen == showLen)
{
showLen = CHAR_SPACING;
curLen = 0;
state = 2;
}
break;
case 2:
colData = 0;
curLen++;
if (curLen == showLen)
state = 0;
break;
default:
state = 0;
}
return(colData);
}

void scrollText(void)
{
static uint32_t prevTime = 0;
if (millis()-prevTime >= SCROLL_DELAY)
{
mx.transform(MD_MAX72XX::TSR);
prevTime = millis();
}
}

void setup()
{
mx.begin();
mx.setShiftDataInCallback(scrollDataSource);
// Define o nivel de luminosidade
mx.control(MD_MAX72XX::INTENSITY, 4);
// Mensagem a ser exibida
strcpy(curMessage, "DAFT PUNK -------->>>>.<<<< GO…GO…GO…GO —0–0— ");
newMessage[0] = ‘\0’;
}

void loop()
{
scrollText();
}

Bom, o cara que fez esse código está usando uma lib para trabalhar direto com o Maxim 7219 ou 7221, que são BCD Decoders muito utilizados para isso (painéis de LED, displays de segmentos e etc.), porém a sua Matriz é 30 x 8 e esse CI’s tem pinagem suficientes para receber 8 anodos e 8 catodos, o suficiente para uma matriz 8x8 (ou 64 LED’s), a primeira coisa que terá que fazer é construir matrizes de 8x8 até chegar a quantas desejar. Se quiser 32x8, construa 4 8x8 e precisará de 4 7219/7221.

Após fazer a matriz 8x8, terá 8 anodos comuns e 8 catodos comuns que serão ligados no CI, o restante da pinagem, força, terra, data e clock serão ligados em chaining nos CI’s para enfim chegarem ao seu Arduino.

Depois disso, a utilização não é muito diferente da operação de um Display normal: http://blog.fazedores.com/coloque-um-display-lcd-em-seu-projeto-com-arduino/ e do conceito de vetores (arrays), se quiser ligar o primeiro LED, devevá passar energia ao anodo na posição 0, 0 ou seja:

1, 0, 0, 0, 0, 0, 0, 0
0, 0, 0, 0, 0, 0, 0, 0
0, 0, 0, 0, 0, 0, 0, 0
0, 0, 0, 0, 0, 0, 0, 0
0, 0, 0, 0, 0, 0, 0, 0
0, 0, 0, 0, 0, 0, 0, 0
0, 0, 0, 0, 0, 0, 0, 0
0, 0, 0, 0, 0, 0, 0, 0

Para criar animações, basta iterar com loops em cima do array, o mais importante é entender do conceito, não vai adiantar só jogar código e esperar a mágica acontecer que não vai funcionar, tem que ligar o circuito e adaptar o código corretamente.

Obrigado pela ajuda amigo, mas creio que esse código não vai dar olha a Matrix de Led é essa. Como disse não frago nada do códigos, já vi tutoriais mas isso demandaria tempo, coisa que não tenho.

Tem interesse de me ajudar nesse projeto? Quanto vc cobraria?
Vlw…

As animações passando seriam dessas…

Olá, eu não posso te ajudar diretamente porque eu não tenho uma matriz de LED’s aqui, apesar de ter LED’s suficientes para construir uma e um 7219 apenas disponível, não tenho o tempo que gostaria para construí-la no momento, pois quando chego do trabalho vou direto cuidar da minha filha. O que posso fazer é o que venho fazendo já, ir te apontando o caminho a seguir e para isso, não precisa me pagar. No entanto, se alguém se interessar e fazer a lógica para você, melhor.

Você disse que tinha uma matriz 30x8, mas você postou a imagem de uma 8x8, provavelmente com um circuito embutido…

Entendo amigo,

É que são 4 matrix de 8x8 ligas…

se tiver alguém para indicar ficaria grato…

Amigo achei um Sketch pronto do jeito que eu quero. Só não está funcionando vc sabe me dizer o pq?
Baichei a library do “Potentiometer.h” que não tinha.

https://docs.google.com/document/d/1K7Pk0Es5I2GGb56jcFQUs9iQKsj_z4fbvD8uxrp-K9w/edit?usp=sharing

Pelo que estou vendo, esse código necessita de um potenciômetro além das matrizes, percebi que ele é usado para alterar a velocidade e modo da animação, de resto, se realmente o código está correto, basta ligar a pinagem corretamente: latch: 8, clock: 12 e data: 11 e o restante das matrizes em chaining conforme a foto.

Sksdutra achei um outro código perfeito que não precisa do potenciômetro e é sequencial, só que a animação é para uma matrix de led com 1 MAX7219. tá funfando bacana só que a animação se repete em todas as matrix.
Tem algum código para a animação ampliar para as outras matrizes?
Vlw…
Da uma olhada…
https://docs.google.com/document/d/1exLI1N2kjpecqlPOD9oBAiqBhlu9p0KdBPdE-REIjG8/edit?usp=sharing

Basta ler a referência da biblioteca “LedControl”, lá você verá a seguinte descrição:

The fourth argument to LedControl(dataPin,clockPin,csPin,numDevices) is the number of cascaded MAX72XX devices you’re using with this LedControl.

No caso você deve passar 4 como número de dispositivos:
LedControl lc=LedControl(12,11,10,4);

ahaha;… simples… ke isso filhaum… ahahhaa

vlw de mais… mas aki no modelo do potenciômetro não funcionou… tem que ter o potenciômetro para funcionar? Ou tem algo errado no código…

Creio que precise, pois ele serve para passar muitas variáveis para a matriz.

Ih filhaum funcionou naum… inseri o 4 e a animação passou só para uma matrix, as outras apagaram…
Será que esse comando não tem nada haver… algomo como apenas 5 fileiras de leds… O cara que pequei o código falou que era apenas para 1 MAX72XX

void displayCharacterCenter(byte character[]) {
lc.clearDisplay(0);

lc.setColumn(0,0,false);
lc.setColumn(0,1,character[0]);
lc.setColumn(0,2,character[1]);
lc.setColumn(0,3,character[2]);
lc.setColumn(0,4,character[3]);
lc.setColumn(0,5,character[4]);
lc.setColumn(0,6,character[5]);
lc.setColumn(0,7,false);

SKSDutra,

EU ACHEI ESSE CÓDIGO, SÓ NÃO SEI SE DÁ EM UM MAX72XX, NÃO FUNCIONOU… creio que deve ser alguma coisa haver com esse código… nuca vi parecido…

static LedControl lcf = LedControl(12,11,10,4);
static LedControl lcs = LedControl(7,6,5,1);

será que este está mais fácil de mexer?

https://docs.google.com/document/d/1QFvl2ZIxmHvqcnBG4aMojKQSWgVzksmokz05AKGdjU4/edit?usp=sharing

Bom, qualquer um dá pra fazer, mas temos que fazer as adaptações corretamente, o fato de eu não ter os componentes para ajudar, também prejudica um pouco.

O código mais legível que você apresentou foi este do LedControl, então eu continuarei a trabalhar com ele, esse novo código insere mais uma variável que são os led’s das orelhas.

Então deixa eu ver mais um pouco sobre a lib LedControl e depois te dou uma resposta.

Só digo que, o fato do restante das matrizes terem apagado é um indicativo bom e não ruim, quer dizer que elas provavelmente estão aguardando informação, ela apenas não foi enviada.

1 curtida

Obrigadasso amigo…

Bom, dei uma simplificada no código de forma que ele pegue todos os dispositivos, como estou no trabalho e não tenho como testar, fica aí para você fazer… Mas é só para teste, para adicionar efeitos, é necessário alterar muita coisa e aí fica contigo, porque não tenho como alterar tanta coisa:

#include "LedControl.h"

LedControl lc = LedControl(12,11,10,4);

byte D[6]={B01111110,B01111110,B01000010,B01000010,B00111100,B00111100};
byte A[6]={B00111110,B01111110,B01001000,B01001000,B01111110,B00111110};
byte F[6]={B00111110,B01111110,B01001000,B01001000,B01001000,B01000000};
byte T[6]={B01000000,B01000000,B01111110,B01111110,B01000000,B01000000};
byte space[6]={B00000000,B00000000,B00000000,B00000000,B00000000,B00000000};
byte P[6]={B01111110,B01111110,B01001000,B01001000,B00110000,B00110000};
byte U[6]={B01111100,B01111110,B00000110,B00000110,B01111110,B01111100};
byte N[6]={B01111110,B00111110,B00011000,B00001100,B01111110,B01111110};
byte K[6]={B01111110,B01111110,B00011000,B00111100,B01100110,B01000010};

void setup() {
    for (int device = 0; device < lc.getDeviceCount(); device++) {
        lc.shutdown(device, false);
        lc.setIntensity(device, 12);
        lc.clearDisplay(device);
    }
}

void displayDaftPunk(unsigned long delaytime) {
    displayCharacterCenter(0, D); delay(delaytime); 
    displayCharacterCenter(1, A); delay(delaytime);
    displayCharacterCenter(2, F); delay(delaytime);
    displayCharacterCenter(3, T); delay(delaytime);
}

void displayCharacterCenter(int device, byte character[]) {
    lc.clearDisplay(device);
    lc.setColumn(device, 0, false);
    lc.setColumn(device, 1, character[0]);
    lc.setColumn(device, 2, character[1]);
    lc.setColumn(device, 3, character[2]);
    lc.setColumn(device, 4, character[3]);
    lc.setColumn(device, 5, character[4]);
    lc.setColumn(device, 6, character[5]);
    lc.setColumn(device, 7, false);
}

void loop() { 
    for (int device = 0; device < lc.getDeviceCount(); device++) {
        lc.setIntensity(device, 12);
        lc.clearDisplay(device);
    }
    displayDaftPunk(1000); delay(10000);
}

Blz… vlw … Skasdutra, deu um erro

sketch_oct07d.ino: In function ‘void setup()’:
sketch_oct07d:13: error: ‘device’ was not declared in this scope
sketch_oct07d.ino: In function ‘void loop()’:
sketch_oct07d:37: error: ‘device’ was not declared in this scope

A marcação amarela ficou no comando:
for (device = 0; device < lc.getDeviceCount(); device++) {

Será que é falta de uma Bibliteca?

SKsdutra consegui fazer o código funcionar… substituir o finalzim…
Nem sei que fiz… só tinha visto algo parecido e os comando tava muito parecido e substituir. Vlw demais amigo…

Cara preciso saber como faço para inserir as outras animações? Que só tem a da Escrita Daft Punk…

Tentei aqui inserir o código antigo no novo comando e deu erro no “displayCharacterLeft(heart);”, deletei esse comando e inseri “heart” no “void displayPulsatingHeart(heart) {” e deu erro lá em cima no código da na letra “F”

#include “LedControl.h”

LedControl lc = LedControl(12,11,10,4);

byte D[6]={B01111110,B01111110,B01000010,B01000010,B00111100,B00111100};
byte A[6]={B00111110,B01111110,B01001000,B01001000,B01111110,B00111110};
byte F[6]={B00111110,B01111110,B01001000,B01001000,B01001000,B01000000};
byte T[6]={B01000000,B01000000,B01111110,B01111110,B01000000,B01000000};
byte space[6]={B00000000,B00000000,B00000000,B00000000,B00000000,B00000000};
byte P[6]={B01111110,B01111110,B01001000,B01001000,B00110000,B00110000};
byte U[6]={B01111100,B01111110,B00000110,B00000110,B01111110,B01111100};
byte N[6]={B01111110,B00111110,B00011000,B00001100,B01111110,B01111110};
byte K[6]={B01111110,B01111110,B00011000,B00111100,B01100110,B01000010};

byte L[6]={B01111110,B01111110,B00000010,B00000010,B00000010,B00000010};
byte O[6]={B00111100,B01111110,B01000010,B01000010,B01111110,B00111100};
byte V[6]={B01111000,B01111100,B00000110,B00000110,B01111100,B01111000};
byte E[6]={B01111110,B01111110,B01001010,B01001010,B01001010,B01000010};

byte G[6]={B00111100,B01111110,B01000010,B01001010,B01101010,B00101100};
byte M[6]={B01111110,B00111110,B00010000,B00010000,B00111110,B01111110};
byte R[6]={B01111110,B01111110,B01001000,B01001000,B00110110,B00110110};

byte heart[6]={B01111000,B01111100,B00111110,B01111100,B01111000,B00110000};

byte paddle1=B11100000;
byte paddle2=B01110000;
byte paddle3=B00111000;
byte paddle4=B00011100;
byte paddle5=B00001110;
byte paddle6=B00000111;

byte pongScore1[6]={B01111000,B01111000,B00000000,B00011110,B00010010,B00011110};
byte pongScore2[6]={B01111000,B01111000,B00000000,B00000000,B00011110,B00011110};
byte pongScore3[6]={B01111000,B01111000,B00000000,B00010010,B00010110,B00011010};

byte invader1[8]={B00011000,B00111110,B01101010,B01111000,B01111000,B01101010,B00111110,B00011000};
byte invader2[8]={B00011100,B00111000,B01101110,B00111100,B00111100,B01101110,B00111000,B00011100};

void setup() {
int devices=lc.getDeviceCount();
//we have to init all devices in a loop
for(int address=0;address<devices;address++) {
/The MAX72XX is in power-saving mode on startup/
lc.shutdown(address,false);
/* Set the brightness to a medium values /
lc.setIntensity(address,12);
/
and clear the display */
lc.clearDisplay(address);
}
}
void displayDaftPunk(unsigned long delaytime) {
displayCharacterCenter(0, D); delay(delaytime);
displayCharacterCenter(1, A); delay(delaytime);
displayCharacterCenter(2, F); delay(delaytime);
displayCharacterCenter(3, T); delay(delaytime);
displayCharacterCenter(0, P); delay(delaytime);
displayCharacterCenter(1, U); delay(delaytime);
displayCharacterCenter(2, N); delay(delaytime);
displayCharacterCenter(3, K); delay(delaytime);

}

void displayLove(unsigned long delaytime) {
displayCharacterCenter(0, L); delay(delaytime);
displayCharacterCenter(1, O); delay(delaytime);
displayCharacterCenter(2, V); delay(delaytime);
displayCharacterCenter(3, E); delay(delaytime);
displayCharacterCenter(0, space); delay(delaytime);

}

void displayPulsatingHeart() {

displayCharacterLeft(heart);

for(int i=1;i<10;i++) {
delay(2000);
for(int k=1;k<16;k++) {
lc.setIntensity(0,k);
delay(20);
}
for(int l=14;l>=0;l–) {
lc.setIntensity(0,l);
delay(20);
}
}

}

void scrollDaftPunk(unsigned long delaytime) {

scrollCharacter(delaytime, D);
scrollCharacter(delaytime, A);
scrollCharacter(delaytime, F);
scrollCharacter(delaytime, T);
scrollCharacter(delaytime/2, space);
scrollCharacter(delaytime, P);
scrollCharacter(delaytime, U);
scrollCharacter(delaytime, N);
scrollCharacter(delaytime, K);
scrollCharacter(delaytime/2, space);

}

void scrollGameOver(unsigned long delaytime) {

scrollCharacter(delaytime, G);
scrollCharacter(delaytime, A);
scrollCharacter(delaytime, M);
scrollCharacter(delaytime, E);
scrollCharacter(delaytime/2, space);
scrollCharacter(delaytime, O);
scrollCharacter(delaytime, V);
scrollCharacter(delaytime, E);
scrollCharacter(delaytime, R);
scrollCharacter(delaytime/2, space);

}

/*
This method will display Daft Punk on an 8x8 LED array.
6x6 characters displayed centered.
*/
void scrollDaftPunkWithPause(unsigned long delaytime) {

scrollCharacterWithPauseAndFlare(delaytime, D);
scrollCharacterWithPauseAndFlare(delaytime, A);
scrollCharacterWithPauseAndFlare(delaytime, F);
scrollCharacterWithPauseAndFlare(delaytime, T);
scrollCharacterWithPauseAndFlare(delaytime, space);
scrollCharacterWithPauseAndFlare(delaytime, P);
scrollCharacterWithPauseAndFlare(delaytime, U);
scrollCharacterWithPauseAndFlare(delaytime, N);
scrollCharacterWithPauseAndFlare(delaytime, K);
scrollCharacterWithPauseAndFlare(delaytime, space);

}

void displayCharacterCenter(int device, byte character[]) {
lc.clearDisplay(device);
lc.setColumn(device, 0, false);
lc.setColumn(device, 1, character[0]);
lc.setColumn(device, 2, character[1]);
lc.setColumn(device, 3, character[2]);
lc.setColumn(device, 4, character[3]);
lc.setColumn(device, 5, character[4]);
lc.setColumn(device, 6, character[5]);
lc.setColumn(device, 7, false);
}
void loop() {

     int devices=lc.getDeviceCount();

//we have to init all devices in a loop
for(int row=0;row<8;row++) {
for(int col=0;col<8;col++) {
for(int address=0;address<devices;address++) {
lc.setLed(address,row,col,true);
lc.setLed(address,row,col,false);
}
displayDaftPunk(1000); delay(10000);
}
}
}