Buchstabe auf "doppel-" Rainbowduino schreiben

Hallo Foren-Gemeinde,
nachdem bei uns der Winter mit viel Schnee eingebrochen ist, will ich mich weiter mit Arduino beschäftigen.

Ausgangsstellung:
Ich habe ein Arduino Mega2560 sowie 2 Rainbowduino die "zusammengeschlossen" sind und ein Keypad.

Aufgabe:
Ich möchte einfach einen Buchstabe oder eine Zahl (welche per Taste eines KeyPads ausgewählt werden) auf ein Rainbowduino und eine weitere Zahl oder Buchstabe auf das andere Rainbowduino in einer bestimmten Farbe schreiben.

Frage:
Wie kann ich dies Realisieren?
Ich habe irgend wie gelesen dass da erst eine "Firmware" auf das Rainbowduino muss. Wie geht das? Hat jemand schon einmal etwas ähnliches gemacht?

Vielen Dank schon im Voraus für eure Geduld...

Gruß Basti

//MODIFY
Muss ich Seriell Ansteuern, aber wie?

2 Rainbowduino die "zusammengeschlossen"

Welche Version der "Rainbowduino"s und wie zusammengeschlossen?

Muss ich Seriell Ansteuern, aber wie?

Meist wird dazu von einem Microcontroller aus der I2C Bus genommen. Die serielle Schnittstelle ist zwar in der neusten Version auch vorhanden, aber für die Verbindung mehrerer Module nicht so gut geeignet.

Rainbowduino hat eine seriellen Eingang. Du könntest 2 Serielle schnittstellen des Arduino nehmen (der hat ja 4 Stück davon, 3 sind frei).

Grüße Uwe

OK, mal sehen, danke erstmal...

So, Hallo mal wieder :wink:
Heute kamen meine 2 Rainbowduino.

Strom dran -> sieht schon mal gut aus.

Jetzt habe Ich von meinem ATMega2560 den Pin 0(RX) an Rainbowduino RX, 1(TX) an TX, Reset an DTR und den Strom angeschlossen und wollte folgenden Code "auf das Rainbowduino" zeichnen.

und siehe da: Funktioniert nicht.

Was mache ich Falsch?

Mein Code (von SeeedMaster):

extern unsigned char dots_color[3][8][4];
extern unsigned char ASCII_Number[10][8];
extern unsigned char ASCII_Char[52][8];

unsigned char State = 2;
unsigned char color=0,row=0,dots=0,position=0;
unsigned char line=0,level=0;
unsigned long timeout;
unsigned char Col_Red,Col_Blue,Col_Green;

/*
This is a hacky implementation of a RainbowDuino serial interface. You need to upload the serial sketch to the RainbowDuino device.
You cannot use multiple devices with this sketch.

If you see garbled characters, reset the RainbowDuino. 

This implementation removes the inital handshake required (and advised) for I2C. This varient just sends data down the line hoping the Rainbowduino is in an appropriate state to 
output to screen.
*/

void setup()
{
  Serial.begin(115200); //Setup high speed Serial
   
}

void loop()
{
    SetRGB(0x0F,0x00,0x00); // Set Colour
    SentChar(10,'T'); // Send Char
    delay(200); // Wait a bit (note: Serial is FAR faster than I2C)
    SetRGB(0x0F,0x04,0x00);
    SentChar(9,'e');
    delay(200);
    SetRGB(0x0F,0x0F,0x00);
    SentChar(8,'a');
    delay(200);
    SetRGB(0x00,0x0F,0x00);
    SentChar(7,'m');
    delay(400);
    SetRGB(0x00,0x0F,0x08);
    SentChar(6,'M');
    delay(200);
    SetRGB(0x00,0x00,0x0F);
    SentChar(5,'C');
    delay(200);
    SetRGB(0x0F,0x04,0x0F);
    SentChar(4,'S');
    delay(200);   
    
    SetRGB(0x0F,0x00,0x00);
    SentChar(10,' ');
    delay(200);
    
        SetRGB(0x0F,0x00,0x00);
    SentChar(10,'A');
    delay(200);
    SetRGB(0x0F,0x04,0x00);
    SentChar(9,'t');
    delay(200);
    SetRGB(0x0F,0x0F,0x00);
    SentChar(8,'o');
    delay(200);
    SetRGB(0x00,0x0F,0x00);
    SentChar(7,'m');
    delay(400);
    SetRGB(0x00,0x0F,0x08);
    SentChar(6,'R');
    delay(200);
    SetRGB(0x00,0x00,0x0F);
    SentChar(5,'i');
    delay(200);
    SetRGB(0x0F,0x04,0x0F);
    SentChar(4,'o');
    delay(200);     
    SetRGB(0x0F,0x04,0x0F);
    SentChar(4,'t');
    delay(200);      
  delay(900);


}



//-------------------------------------------------------------
//Name:SendData
//Function: Master sent one buff data to RainbowDuino or sent the color data to RainbowDuino
//Parameter:  ADD: RainbowDuino IIC Address
//            Auto:if Auto = 1 sent the data in buff ; if Auto = 0 then sent the RGB data 
//            Red Green Blue: when Auto = 0 ,sent these color data to RainbowDuino
//-------------------------------------------------------------
void SendData(int ADD,int Auto,int Red,int Green,int Blue)
{  
  int OK=0;
  int tempcol;
  while(!OK)
  { 
    switch(State)
    {  
    case 2:
      for (color=0;color<3;color++)
      {     
        if (color==0)
        { 
          tempcol=Green;
          tempcol|=(Green<<4);
        }
        else if(color==1)
        {
          tempcol=Red;
          tempcol|=(Red<<4);
        }
        else if(color==2)
        {
          tempcol=Blue;
          tempcol|=(Blue<<4);
        }

        //// Serial.beginTransmission(ADD); 
        for (row=0;row<8;row++)
        {

          for (dots=0;dots<4;dots++)
          {
            // if (Auto)
            Serial.write(dots_color[color][row][dots]);
            //  else
            //     Serial.write(tempcol);
          }

        }
        // //Serial.endTransmission();    // stop transmitting
        delay(5);  
      }
      OK=1;
      State=2;    
      break;

    default:
      State=2;
      break;
    }
  }

}
//-------------------------------------------------------------
//Name:SendShiftData
//Function: Master sent shift the  buff and sent the data to RainbowDuino  
//Parameter:  ADD: RainbowDuino IIC Address
//            shift: set up how much bit  the buff data will shift left            
//-------------------------------------------------------------
void SendShiftData(int ADD,int shift)
{  
  int OK=0;
  int temp,val;
  while(!OK)
  { 
    switch(State)
    {  
    case 2:
      for (color=0;color<3;color++)
      {   
        // Serial.beginTransmission(ADD);    
        for (row=0;row<8;row++)
        {

          for (dots=0;dots<4;dots++)
          {                                     
            if (shift&0x01)
            {
              temp = dots + (shift>>1);
              val = ((dots_color[color][row][(temp<4)?(temp):(temp-4)]<<4)|(dots_color[color][row][(temp<3)?(temp):(temp-3)]>>4));  
              Serial.write(val); 
            }        
            else
            {
              temp = dots + (shift>>1);
              val = dots_color[color][row][(temp<4)?(temp):(temp-4)];  
              Serial.write(val);  
            }                         
          }   
        }
        //Serial.endTransmission();    // stop transmitting
        delay(5);
      }
      OK=1;
      State=2;    
      break;

    default:
      State=2;
      break;
    }
  }

}


//-------------------------------------------------------------
//Name:FillBuff
//Function: Fill the master's buff with color data  
//Parameter: Re, Gr, Bl  : RGB color level data        
//-------------------------------------------------------------
void FillBuff(int Re,int Gr,int Bl)
{   
  for(color=0;color<3;color++)
  {
    for (row=0;row<8;row++)
    {
      for (dots=0;dots<4;dots++)
      {
        switch (color)
        {
        case 0://green
          dots_color[color][row][dots]=( Gr|(Gr<<4));
          break;

        case 1://blue
          dots_color[color][row][dots]= (Bl|(Bl<<4));
          break;

        case 2://red
          dots_color[color][row][dots]= (Re|(Re<<4));
          break;

        default:
          break;
        }
      }
    }
  }
}




//-------------------------------------------------------------
//Name:SetLine
//Function:  change one line data of  the master's buff   
//Parameter: Re, Gr, Bl  : RGB line color  data    
//           levl: the RGB level 
//           lines: line position
//-------------------------------------------------------------
void SetLine(int levl,int lines,int Red,int Green,int Blue)
{ 
  int  shift; 
  for (color=0;color<3;color++)
  {
    if (color==0)
      shift=Green;
    else if (color==1)
      shift=Blue;
    else if (color==2)
      shift=Red;
    for (dots=0;dots<4;dots++)
    {
      dots_color[color][line][dots]=0;
      if(dots!=0)  shift=shift<<1;
      if (shift&0x80)
        dots_color[color][line][dots]|=(level<<4);
      else
        dots_color[color][line][dots]&=0x0F;


      shift=shift<<1;         
      if (shift&0x80)
        dots_color[color][line][dots]|=level;
      else
        dots_color[color][line][dots]&=0xF0; 

    }
  }

}




//-------------------------------------------------------------
//Name:FillLine
//Function:  Fill one line data of  the master's buff   
//Parameter: Re, Gr, Bl  : RGB color level data    
//           Lines : the line position
//-------------------------------------------------------------
void FillLine(int Lines,int Red,int Green,int Blue)
{ 
  int  shift; 
  for (color=0;color<3;color++)
  {
    if (color==0)
      shift=Green;
    else if (color==1)
      shift=Blue;
    else if (color==2)
      shift=Red;
    for (dots=0;dots<4;dots++)
    {
      dots_color[color][Lines][dots]=0;

      shift|=shift<<4;
      dots_color[color][Lines][dots]=shift;
    }
  }

}



//-------------------------------------------------------------
//Name:SetDots
//Function:  change one dot data of  the master's buff   
//Parameter: Row_X, Line_Yint: the dot position
//           Re, Gr, Bl  : RGB color level data    
//-------------------------------------------------------------
void SetDots(int Row_X,int Line_Y,int Red,int Green,int Blue)
{
  dots_color[0][Line_Y][Row_X/2]&=(Row_X&1)?(0xf0):(0x0f);
  dots_color[0][Line_Y][Row_X/2]|=(Row_X&1)?(Green):(Green<<4);
  dots_color[1][Line_Y][Row_X/2]&=(Row_X&1)?(0xf0):(0x0f);
  dots_color[1][Line_Y][Row_X/2]|=(Row_X&1)?(Blue):(Blue<<4);
  dots_color[2][Line_Y][Row_X/2]&=(Row_X&1)?(0xf0):(0x0f);
  dots_color[2][Line_Y][Row_X/2]|=(Row_X&1)?(Red):(Red<<4);     
}






//-------------------------------------------------------------
//Name:SetRGB
//Function:  Set the  Global color Variables  
//Parameter:  Re, Gr, Bl  : RGB color level data            
//-------------------------------------------------------------
void SetRGB(int Red,int Green,int Blue)
{
  Col_Red=Red;
  Col_Blue=Blue;
  Col_Green=Green;   
}




//-------------------------------------------------------------
//Name:SentNum
//Function: Sent a Numeber to RainbowDuino to show  
//Parameter:   ADD: RainbowDuino IIC Address
//             Num: the Num want to show
//Other: the Number character color definet by the Global color Variables which set up by SetRGB() function
//-------------------------------------------------------------
void SentNum(int ADD,int Num)
{  
  int OK=0;
  int tempword,tempdata,tempcol;
  while(!OK)
  { 
    switch(State)
    {  
    case 2:
      for (color=0;color<3;color++)
      {     
        if(color==0)        tempcol=Col_Green;
        else if(color==1)   tempcol=Col_Red;
        else if(color==2)   tempcol=Col_Blue;

        // Serial.beginTransmission(ADD); 
        for (row=0;row<8;row++)
        {

          for (dots=0;dots<4;dots++)
          {

            tempword = ASCII_Number[Num][row];
            if((tempword<<2*dots)&0x80)
            {
              tempdata&=0x0F;
              tempdata|=(tempcol<<4);
            }
            else
            {
              tempdata&=0x0F;
            }

            if((tempword<<(2*dots+1))&0x80)
            {
              tempdata&=0xF0;
              tempdata|=tempcol;
            }
            else
            {
              tempdata&=0xF0;
            }           
            Serial.write(tempdata); 

          }

        }
        //Serial.endTransmission();    // stop transmitting
        delay(5);  
      }
      OK=1;
      State=2;    
      break;

    default:
      State=2;
      break;
    }
  }
}



//-------------------------------------------------------------
//Name:SentChar
//Function: Sent a  English Latter character to RainbowDuino to show  
//Parameter:   ADD: RainbowDuino IIC Address
//             Chr: the Latter want to show
//Other: the Latter character color definet by the Global color Variables which set up by SetRGB() function
//-------------------------------------------------------------
void SentChar(int ADD,int Chr)
{  
  int OK=0;
  int tempword,tempdata,tempcol;
  while(!OK)
  { 
    switch(State)
    {  
    case 2:
      for (color=0;color<3;color++)
      {     
        if(color==0)        tempcol=Col_Green;
        else if(color==1)   tempcol=Col_Red;
        else if(color==2)   tempcol=Col_Blue;

        // Serial.beginTransmission(ADD); 
        for (row=0;row<8;row++)
        {

          for (dots=0;dots<4;dots++)
          {
            if ((Chr>64)&&(Chr<91))
            {
              Chr-=65;
            }
            else if((Chr>96)&&(Chr<123))
            {
              Chr-=71;
            }


            tempword = ASCII_Char[Chr][row];
            if((tempword<<2*dots)&0x80)
            {
              tempdata&=0x0F;
              tempdata|=(tempcol<<4);
            }
            else
            {
              tempdata&=0x0F;
            }

            if((tempword<<(2*dots+1))&0x80)
            {
              tempdata&=0xF0;
              tempdata|=tempcol;
            }
            else
            {
              tempdata&=0xF0;
            }           
            Serial.write(tempdata); 

          }

        }
        //Serial.endTransmission();    // stop transmitting
        delay(5);  
      }
      OK=1;
      State=2;    
      break;

    default:
      State=2;
      break;
    }
  }
}
//-------------------------------------------------------------
//Name:Shift_Num_Right
//Function: Sent a Numeber with shift to RainbowDuino to show  
//Parameter:   ADD: RainbowDuino IIC Address
//             Num: the Num want to show
//             Shift: Shift right bits(0-8)
//Other: the Number character color definet by the Global color Variables which set up by SetRGB() function
//-------------------------------------------------------------
void Shift_Num_Right(int ADD,int Num,int Shift)
{  
  int OK=0;
  int tempword,tempdata,tempcol;
  while(!OK)
  { 
    switch(State)
    {  
    case 2:
      for (color=0;color<3;color++)
      {     
        if(color==0)        tempcol=Col_Green;
        else if(color==1)   tempcol=Col_Red;
        else if(color==2)   tempcol=Col_Blue;

        // Serial.beginTransmission(ADD); 
        for (row=0;row<8;row++)
        {

          for (dots=0;dots<4;dots++)
          {

            tempword = ASCII_Number[Num][row];


            if((tempword<<(2*dots+Shift))&0x80)
            {
              tempdata&=0x0F;
              tempdata|=(tempcol<<4);
            }
            else
            {
              tempdata&=0x0F;
            }

            if((tempword<<(2*dots+1+Shift))&0x80)
            {
              tempdata&=0xF0;
              tempdata|=tempcol;
            }
            else
            {
              tempdata&=0xF0;
            }           
            Serial.write(tempdata); 

          }

        }
        //Serial.endTransmission();    // stop transmitting
        delay(5);  
      }
      OK=1;
      State=2;    
      break;

    default:
      State=2;
      break;
    }
  }
}


//-------------------------------------------------------------
//Name:Shift_Num_Left
//Function: Sent a Numeber with shift to RainbowDuino to show  
//Parameter:   ADD: RainbowDuino IIC Address
//             Num: the Num want to show
//             Shift: Shift left bits (0-8)
//Other: the Number character color definet by the Global color Variables which set up by SetRGB() function
//-------------------------------------------------------------
void Shift_Num_Left(int ADD,int Num,int Shift)
{  
  int OK=0;
  int tempword,tempdata,tempcol;
  while(!OK)
  { 
    switch(State)
    {     
    case 2:
      for (color=0;color<3;color++)
      {     
        if(color==0)        tempcol=Col_Green;
        else if(color==1)   tempcol=Col_Red;
        else if(color==2)   tempcol=Col_Blue;

        // Serial.beginTransmission(ADD); 
        for (row=0;row<8;row++)
        {

          for (dots=0;dots<4;dots++)
          {

            tempword = ASCII_Number[Num][row];

            tempword=tempword>>Shift;
            if((tempword<<(2*dots))&0x80)
            {
              tempdata&=0x0F;
              tempdata|=(tempcol<<4);
            }
            else
            {
              tempdata&=0x0F;
            }

            if((tempword<<(2*dots+1))&0x80)
            {
              tempdata&=0xF0;
              tempdata|=tempcol;
            }
            else
            {
              tempdata&=0xF0;
            }           
            Serial.write(tempdata); 

          }

        }
        //Serial.endTransmission();    // stop transmitting
        delay(5);  
      }
      OK=1;
      State=2;    
      break;

    default:
      State=2;
      break;
    }
  }
}


//-------------------------------------------------------------
//Name: Shift_Char_Right
//Function: Sent a Latter character with shift to RainbowDuino to show  
//Parameter:   ADD: RainbowDuino IIC Address
//             Chr: the Latter want to show
//             Shift: Shift right bits (0-8)
//Other: the Latter character color definet by the Global color Variables which set up by SetRGB() function
//-------------------------------------------------------------
void Shift_Char_Right(int ADD,int Chr,int Shift,int BG)
{  
  int OK=0;
  int tempword,tempdata,tempcol;
  while(!OK)
  { 
    switch(State)
    {  
    case 2:
      for (color=0;color<3;color++)
      {     
        if(color==0)        tempcol=Col_Green;
        else if(color==1)   tempcol=Col_Red;
        else if(color==2)   tempcol=Col_Blue;

        // Serial.beginTransmission(ADD); 
        for (row=0;row<8;row++)
        {

          for (dots=0;dots<4;dots++)
          {
            if ((Chr>64)&&(Chr<91))
            {
              Chr-=65;
            }
            else if((Chr>96)&&(Chr<123))
            {
              Chr-=71;
            }
            tempword = ASCII_Char[Chr][row];


            if((tempword<<(2*dots+Shift))&0x80)
            {
              tempdata&=0x0F;
              tempdata|=(tempcol<<4);
            }
            else
            {
              tempdata&=0x0F;
              if(BG)  tempdata|=(dots_color[color][row][dots]&0xf0);

            }

            if((tempword<<(2*dots+1+Shift))&0x80)
            {
              tempdata&=0xF0;
              tempdata|=tempcol;
            }
            else
            {
              tempdata&=0xF0;
              if(BG)  tempdata|=(dots_color[color][row][dots]&0x0f);

            }           
            Serial.write(tempdata); 

          }

        }
        //Serial.endTransmission();    // stop transmitting
        delay(5);  
      }
      OK=1;
      State=2;    
      break;

    default:
      State=2;
      break;
    }
  }
}


//-------------------------------------------------------------
//Name: Shift_Char_Left
//Function: Sent a Latter character with shift to RainbowDuino to show  
//Parameter:   ADD: RainbowDuino IIC Address
//             Chr: the Latter want to show
//             Shift: Shift left bits (0-8)
//Other: the Latter character color definet by the Global color Variables which set up by SetRGB() function
//-------------------------------------------------------------
void Shift_Char_Left(int ADD,int Chr,int Shift,int BG)
{  
  int OK=0;
  int tempword,tempdata,tempcol;
  while(!OK)
  { 
    switch(State)
    {  
    case 2:
      for (color=0;color<3;color++)
      {     
        if(color==0)        tempcol=Col_Green;
        else if(color==1)   tempcol=Col_Red;
        else if(color==2)   tempcol=Col_Blue;

        //Serial.beginTransmission(ADD);
        for (row=0;row<8;row++)
        {

          for (dots=0;dots<4;dots++)
          {
            if ((Chr>64)&&(Chr<91))
            {
              Chr-=65;
            }
            else if((Chr>96)&&(Chr<123))
            {
              Chr-=71;
            }
            tempword = ASCII_Char[Chr][row];                
            tempword=tempword>>Shift;

            if((tempword<<(2*dots))&0x80)
            {
              tempdata&=0x0F;
              tempdata|=(tempcol<<4);
            }
            else
            {
              tempdata&=0x0F;
              if(BG)  tempdata|=(dots_color[color][row][dots]&0xF0);

            }

            if((tempword<<(2*dots+1))&0x80)
            {
              tempdata&=0xF0;
              tempdata|=tempcol;
            }
            else
            {
              tempdata&=0xF0;
              if(BG)  tempdata|=(dots_color[color][row][dots]&0x0f);

            }           
            Serial.write(tempdata); 

          }

        }
        ////Serial.endTransmission();    // stop transmitting
        delay(5);  
      }
      OK=1;
      State=2;    
      break;

    default:
      State=2;
      break;
    }
  }
}

Versuchs mal mitt einer anderen seriellen Schnittstelle. die erste ist an dem USB-Seriel Adapter angeschlossen.
grüße Uwe

Hab ich probiert, geht nicht.

Muss ich (außer die 2 zusammenschließen) noch irgend etwas tun?

Brauche ich die Pins SDA und SCL (I2C)?

Habe das Rainbowduino an einen USB TTL Adapter TX->TX RX->RX ... angeschlosse,
wollte eine Firmware aufspielen aber es geht nix.

Bekomme immer die Fehlermeldung: avrdude: stk500_getsync(): not in sync: resp=0x00

Was mache ich nur falsch?

Niemand eine IDEE???

Hufy1990:
Hab ich probiert, geht nicht.

Muss ich (außer die 2 zusammenschließen) noch irgend etwas tun?

Brauche ich die Pins SDA und SCL (I2C)?

Die beiden Pins brauchst Du wenn Du die Daten über die I2C Schnittstelle übertragen willst. Der Rainbowduino kann aber auch über die seriele Schnittstelle gesteuert werden.

Hufy1990:
Habe das Rainbowduino an einen USB TTL Adapter TX->TX RX->RX ... angeschlosse,
wollte eine Firmware aufspielen aber es geht nix.

Bekomme immer die Fehlermeldung: avrdude: stk500_getsync(): not in sync: resp=0x00

Was mache ich nur falsch?

Es fehlt die Resetleitung und die Masse (eventuell auch 5V). Um einen ATmega zu programieren muß der Bootloader gestartet werden und das geschiet nur nach dem Einschalten oder einem Reset.

Grüße Uwe

Habe alles angeschlossen, meine pde geöffnet, ATMega328 eingestellt, Reset gedrückt und dann Upload, aber passiert nichts heul

Wieso drückst Du reset?

Welche Fehlermeldungen bekommst Du? Bitte alle Zeilen.
Welches Betriebsystem und welche IDE-Version verwendest Du?
Welchen Sketch lädst Du hoch? Hast Dus mal mit dem einfachen Blink versucht?
Grüße Uwe

Fehlermeldung: Upload abgeschlossen
avrdude: stk500_getsync(): not in sync: resp=0x00

BS: Windows 7 32bit

IDE: Arduino 1.0.1

Sketch:

#include "Rainbow.h"

//=============================================================
extern unsigned char dots_color[2][3][8][4];  //define Two Buffs (one for Display ,the other for receive data)
extern unsigned char GamaTab[16];             //define the Gamma value for correct the different LED matrix
//=============================================================
unsigned char line=0,level=0;  
unsigned char Buffprt = 0;
unsigned char State = 0;
unsigned char color=0,row=0,dots=0,position=0;
unsigned long timeout;
unsigned char StartTransfer = 0;

/*
This is a hacky implementation of a RainbowDuino serial interface. You need to upload the serial sketch to the RainbowDuino device.
You cannot use multiple devices with this sketch.

If you see garbled characters, reset the RainbowDuino. 

This implementation removes the inital handshake required (and advised) for I2C. This varient just sends data down the line hoping the Rainbowduino is in an appropriate state to 
output to screen.
*/

void setup()
{
  _init();

  for(int i=0;i<8;i++)
  {
    flash_next_line(i,1);
    delay(100);
  }

  Serial.begin(115200); // join i2c bus (address optional for master) 
  Serial.println("Hello");
  // Serial.onReceive(receiveEvent); // define the receive function for receiving data from master
  //  Serial.onRequest(requestEvent); // define the request function for the request from maseter 
  init_timer2();  // initial the timer for scanning the LED matrix
  StartTransfer=0;
  color=0;
  row=0;
  dots=0;
  position=0;
}
void loop()
{
  if(Serial.available()>0)  // Switch the Display Buff and Receive Buff until receive one buff data
  {
    SwitchBuff();   //receiving data
  }   
}

ISR(TIMER2_OVF_vect)          //Timer2  Service 
{ 
  TCNT2 = GamaTab[level];    // Reset a  scanning time by gamma value table
  flash_next_line(line,level);  // sacan the next line in LED matrix level by level.
  line++;
  if(line>7)        // when have scaned all LEC the back to line 0 and add the level
  {
    line=0;
    level++;
    if(level>14)       level=0;
  }
}

void init_timer2(void)               
{
  TCCR2A |= (1 << WGM21) | (1 << WGM20);   
  TCCR2B |= (1<<CS22);   // by clk/64
  TCCR2B &= ~((1<<CS21) | (1<<CS20));   // by clk/64
  TCCR2B &= ~((1<<WGM21) | (1<<WGM20));   // Use normal mode
  ASSR |= (0<<AS2);       // Use internal clock - external clock not used in Arduino
  TIMSK2 |= (1<<TOIE2) | (0<<OCIE2B);   //Timer2 Overflow Interrupt Enable
  TCNT2 = GamaTab[0];
  sei();   
}

void _init(void)    // define the pin mode
{
  DDRD=0xff;
  DDRC=0xff;
  DDRB=0xff;
  PORTD=0;
  PORTB=0;

}


//=============================================================


/* /==============================================================
 void receiveEvent(int howMany)
 {
 if (StartTransfer==1)  // if a new transfer starts , then reset the buff position
 {
 StartTransfer=0;
 color=0;
 row=0;
 dots=0;
 position=0;
 }
 
 }
 
 void requestEvent(void)
 {
 StartTransfer =1;  // master start a new data transfer
 Serial.send(2);
 }
 //==============================================================
 
 
 *///==============================================================
void shift_1_bit(unsigned char LS)  //shift 1 bit of  1 Byte color data into Shift register by clock
{
  if(LS)
  {
    shift_data_1;
  }
  else
  {
    shift_data_0;
  }
  clk_rising;
}
//==============================================================
void flash_next_line(unsigned char line,unsigned char level) // scan one line
{
  disable_oe;
  close_all_line;
  open_line(line);
  shift_24_bit(line,level);
  enable_oe;
}

//==============================================================
void shift_24_bit(unsigned char line,unsigned char level)   // display one line by the color level in buff
{
  unsigned char color=0,row=0;
  unsigned char data0=0,data1=0;
  le_high;
  for(color=0;color<3;color++)//GBR
  {
    for(row=0;row<4;row++)
    {
      data1=dots_color[Buffprt][color][line][row]&0x0f;
      data0=dots_color[Buffprt][color][line][row]>>4;

      if(data0>level)   //gray scale,0x0f aways light
      {
        shift_1_bit(1);
      }
      else
      {
        shift_1_bit(0);
      }

      if(data1>level)
      {
        shift_1_bit(1);
      }
      else
      {
        shift_1_bit(0);
      }
    }
  }
  le_low;
}



//==============================================================
void open_line(unsigned char line)     // open the scaning line 
{
  switch(line)
  {
  case 0:
    {
      open_line0;
      break;
    }
  case 1:
    {
      open_line1;
      break;
    }
  case 2:
    {
      open_line2;
      break;
    }
  case 3:
    {
      open_line3;
      break;
    }
  case 4:
    {
      open_line4;
      break;
    }
  case 5:
    {
      open_line5;
      break;
    }
  case 6:
    {
      open_line6;
      break;
    }
  case 7:
    {
      open_line7;
      break;
    }
  }
}



//==============================================================
void SwitchBuff(void)
{
  dots_color[((Buffprt+1)&1)][color][row][dots]=Serial.read();
  dots++;
  position++;
  if(dots>3)
  { 
    dots=0;
    row++;
    if(row>7)
    {  
      row=0;
      color++;
      if(color>2)
      {  
        color=0; 
        if (position==0x60)  
        { 
          Buffprt++;
          Buffprt&=1;   // switch buff
          position=0;
        }
      }
    }
  }
}

TX->TX RX->RX

und warum nicht Tx -> Rx ? Was der eine sendet, soll der andere empfangen ...

OK, habs gekreutzt, TX->RX RX->TX, DTA->Reset, 5V->VCC, GND->GND aber keine änderung...?
Es kommt immer noch: Upload abgeschlossen
Binäre Sketchgröße: 2.982 Bytes (von einem Maximum von 30.720 Bytes)
avrdude: stk500_getsync(): not in sync: resp=0x00

Gibt's doch nicht, keiner eine IDEE?

Entschuldige; da habe ich nicht genau genug durchgelesen.

  1. Der Rainbowduino kann NICHT an TX und RX vom Arduino MEGA angeschlossen werden da diese Schnittstelle für das Upload des Sketches vom PC zum MEGA verwendet wird. Du mußt RX1 und TX1 bzw RX2 und TX2 verwenden. Du brauchst keine Resetleitung.

  2. Du mußt RX1 des MEGA mit TX des Rainbowduino und TX1 mit RX verbinden außerdem GND mit GND. Die Rainbowduinos mußt Du extern mit 5V versorgen (die USB-Schnittstelle wird nicht genug Strom für beide Rainbowduinos mit LED-Matrix liefern).

Wo hast Du den Sketch her?

Grüße Uwe