// Main loop
do
{
if(UART1_DataReady==1)
{
UART1_Write_CText("Reception de : \r\n");
UART1_Write_Text(buffer1); CRLF1();
p1=0;
// strConstRamCpy(buffer1,"RGB1,123,245\r\n");
p1=strstr(buffer1,"RGB");
if (p1>0)
{
cc=*(p1+3);
UART1_Write_CText("Led # ");UART1_Write(cc);
CRLF1();
p1=strtok(p1,","); // 1er appel pour detection virgule
UART1_Write_Text(p1);CRLF1();
// RGB_Led[cc][0]=atoi(p1);
Delay_ms(1000);
i=0;
do
{ p1=strtok(0, ","); // detection des separateurs (virgule) suivants
if (p1!=0)
{
UART1_Write_CText("Parametre ");
WordToStr(i,CRam1);
UART1_Write_Text(CRam1); UART1_Write(TAB);
UART1_Write_Text(p1);
ValColor=atoi(p1);
IntToStr(ValColor,CRam1);
UART1_Write_CText(" ValColor ");UART1_Write_CText(Colors[i]);
UART1_Write(TAB); UART1_Write_Text(CRam1);
CRLF1();
Delay_ms(1000);
i++;
}
}while (p1!=0) ;
CRLF1();
Delay_ms(1000);
}
strConstRamCpy(txt,"\n End of test \n");
UART1_Write_Text(txt);
CRLF1();
RAZ_UART1(); // on nettoie tout
} //if
}
while(1);
}