Deva_Rishi:
(no compile test done, may contain typos..) and we start counting at Ary[0].
Works well!
String msg = "1,2,3,4,5";
uint8_t Ary[5];
uint8_t i = 0, j = 0;
void setup()
{
Serial.begin(9600);
while ( j < msg.length())
{
if (msg.charAt(j) == ',')
{
i++;
}
else
{
Ary[i] = Ary[i] * 10;
if ((msg.charAt(j) < '0') || (msg.charAt(j) > '9'))
{
Ary[i] = 0;
}
else
{
Ary[i] = Ary[i] + (msg.charAt(j) - '0');
}
}
j++;
}
for (int i = 0; i < 5; i++)
{
Serial.print(Ary[i]); //shows 1 2 3 4 5
Serial.print(' ');
}
}
void loop()
{
}