dpmattox:
No, I'm so used to HTML that this is the structure I am used to seeing, and makes it easier for me to read my own code... Even my java looks like that...
It's your code at the end of the day, but I think you're making a mistake. 'C'/C++ and Java are not HTML/XML. In particular, they are not validated XML. Using an indenting scheme that makes it easy to validate the actual control structure (defined by the braces) against the apparent control structure (implied by the indentation) is much more important for these languages than it is for HTML/XML. Your coding style doesn't really do that, because the matching pairs of { and } do not stand out.
dpmattox:
I have no idea what a bounds check is...
I mean check the number of elements already used in the array before appending a new element, to ensure that you don't try to use more elements than the array contains. The way I recommend to do that is to define a constant defining the number of character the array will hold, and declare the array as that size + 1, where the '+1' is the space reserved for the final terminating character. Then you can do something like:
const int BufferLength = 32; // or whatever the length is - I forget
char buffer[BufferLength+1]; // allow space for a null terminator
...
if(serialIn < BufferLength)
{
buffer[serialIn++] = incomingByte;
buffer[serialIn] = 0; // reterminate the string
}
else
{
// buffer is full - discard the character
}