i know i need an array and i could use the atoi function but i just don't understand how to do it
Like so:
char buff[8];
byte indx = 0;
void loop()
{
while(Serial.available() > 0)
{
char ch = Serial.read(); // Get the next character
if(ch >= '0' && ch <= '9')
{
// The character is a digit - 0 to 9
buff[indx++] = ch; // Store it
buff[indx] = '\0'; // Append a NULL
}
else
{
// The character is not a digit
int val = atoi(buff); // Convert to integer
// Use the integer...
indx = 0; // Reset for next time
buff[indx] = '\0';
}
}
}