General

Matrix RGB Led 8x8 project (marker)

userHead Account cancelled 2016-02-02 18:02:31 2595 Views0 Replies
Hi, I am make a project at school for my degrees ( i am french so my english isn't perfect) so I want to use this matrix RGB led 8x8 with my arduino card (I want to use MBED after):
http://www.dfrobot.com/index.php?route= ... uct_id=780
But I need 16x16 led so I combined 4 matrix but i can't make the program:
I can control only one matrix with this program:
Code: Select all
#include <SPI.h>

#define DATA_PIN  11
#define CLK_PIN   13
#define LATCH_PIN 8

void setup() {
  // set the LATCH_PIN as an output:
  pinMode (LATCH_PIN, OUTPUT);
  // initialize SPI:
  SPI.begin();
  // Autre init SPI à prevoir ?
}

void loop() {
 
  byte rouge[16] ={B11111111, B00000000, B00000000, B11111111, B11111111, B00000000, B11111111, B00000000, B11111111, B00000000, B00000000, B11111111, B11111111, B00000000, B11111111, B00000000};
  byte vert[16] ={B00000000, B11111111, B00000000, B11111111, B00000000, B11111111,  B11111111, B00000000, B00000000, B11111111, B00000000, B11111111, B00000000, B11111111,  B11111111, B00000000};
  byte bleu[16] ={B00000000, B00000000, B11111111, B00000000, B11111111, B11111111,  B11111111, B00000000, B00000000, B00000000, B11111111, B00000000, B11111111, B11111111,  B11111111, B00000000};
  byte anode = {B00000000};
  for (int i = 0; i <8 ; i++)
  {
 
    digitalWrite(LATCH_PIN, LOW);
  //  send in the address and value via SPI:
 // Colonne 1,2,3 en bleu
   SPI.transfer(bleu[i]);//B
  SPI.transfer(vert[i]);//G
   SPI.transfer(rouge[i]);//R
   switch (i)
   {
  case (0):
   anode = B00000001 ;
 break;
  case (1):
   anode = B00000010 ;
 break;
 case (2):
   anode = B00000100 ;
 break;
 case (3):
   anode = B00001000 ;
 break;
 case (4):
   anode = B00010000 ;
 break;
 case (5):
   anode = B00100000 ;
 break;
 case (6):
   anode = B01000000 ;
 break;
 case (7):
   anode = B10000000 ;
   
   case (8):
   anode = B00000001;
 break;
  case (9):
   anode = B00000010 ;
 break;
 case (10):
   anode = B00000100 ;
 break;
 case (11):
   anode = B00001000 ;
 break;
 case (12):
   anode = B00010000 ;
 break;
 case (13):
   anode = B00100000 ;
 break;
 case (14):
   anode = B01000000 ;
 break;
 case (15):
   anode = B10000000 ;
 break;
   }
   SPI.transfer(anode);//Anode
  // take the SS pin high to de-select the chip:
digitalWrite(LATCH_PIN,HIGH);   
}
 
 
  for (int i = 0; i <8 ; i++)
  {
 
    digitalWrite(LATCH_PIN, LOW);
  SPI.transfer(bleu[i+8]);//B
  SPI.transfer(vert[i+8]);//G
   SPI.transfer(rouge[i+8]);//R
   
   switch (i)
   {
  case (0):
   anode = B00000001 ;
 break;
  case (1):
   anode = B00000010 ;
 break;
 case (2):
   anode = B00000100 ;
 break;
 case (3):
   anode = B00001000 ;
 break;
 case (4):
   anode = B00010000 ;
 break;
 case (5):
   anode = B00100000 ;
 break;
 case (6):
   anode = B01000000 ;
 break;
 case (7):
   anode = B10000000 ;
   
   
   }
   SPI.transfer(anode);//Anode
  // take the SS pin high to de-select the chip:

digitalWrite(LATCH_PIN,HIGH); }
delay(1); // 1ms de pause avant envoy d'un autre message

 
}


And I don't understand how it's work with 4 matrix connected ( to make a square of 2 on 2).

Thank you to help me :oops: