String s="";
int msgIndx=0;
uint8_t leds[256];
String strs[12];
uint8_t alarms[12];
int StringSplit(String sInput, char cDelim, String sParams[], int iMaxParams)
{
int iParamCount = 0;
int iPosDelim, iPosStart = 0;
Serial.print(sInput);
do {
// Searching the delimiter using indexOf()
iPosDelim = sInput.indexOf(cDelim,iPosStart);
if (iPosDelim > (iPosStart+1)) {
// Adding a new parameter using substring()
sParams[iParamCount] = sInput.substring(iPosStart,iPosDelim-1);
iParamCount++;
// Checking the number of parameters
if (iParamCount >= iMaxParams) {
return (iParamCount);
}
iPosStart = iPosDelim + 1;
}
} while (iPosDelim >= 0);
if (iParamCount < iMaxParams) {
// Adding the last parameter as the end of the line
sParams[iParamCount] = sInput.substring(iPosStart);
iParamCount++;
}
return (iParamCount);
}
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
Serial.println("Hello");
s="A1,20,14,2,1,13,40,2,1,3,45,2";
Serial.println(s);
int StringCount = 0;
s.remove(0,1);
while(s.length()>0)
{
int index = s.indexOf(',');
if (index == -1) // No space found
{
strs[StringCount++] = s;
break;
}
else
{
strs[StringCount++] = s.substring(0, index);
s = s.substring(index+1);
}
}
for (int i = 0; i < StringCount; i++)
{
Serial.print(i);
Serial.print(": \"");
Serial.print(strs[i].toInt());
alarms[i] = strs[i].toInt();
Serial.println("\"");
}
for (int i = 0; i < 12; i++)
{
Serial.println(alarms[i]);
}
}
uint8_t setXY(uint8_t x, uint8_t y)
{
uint8_t i=0;
if(y&1) { i = (x+15 + y*16);
}
else {
i = x+y*15;
}
return i;
}
void loop() {
}