If I had to guess, I'd make a loop that will reasign the index of each character one step back or something like that but I'm not sure if that's how I should do it.
Yep, that's pretty much it...
Here's how I do it:
char data[10];
if (Serial.available()) {
char inch = Serial.read();
for (int i = 0; i < 9; i++) {
data[i] = data[i+1];
}
data[9] = inch;
}
}
Every incoming character gets added to the end of the array after everything else has been shuffled down one place.