I'm moving some code I had working on the 328 over to the 1284 using MegaCore (need larger Flash space to expand), and while most things are working, I have two parts that are not. The one part is a Serial input read for date entry for changing the DS3231 that was working just fine, but now just acts like I entered nothing in the terminal (enter 22, press enter, its like nothing was entered) and won't proceed to the next readaByte() statement for further date inputs.. Does anyone know what the problem is? I've ripped my brains out trying to figure out what is wrong. Changing the syntax over to brackets makes no difference either just incase it was a syntax issue with the compiler.
incomingByte is changing it's value inside the while loop. You might have missed the semicolon after "else" but I agree that using "else" that way is bad programming style.
You do know that Serial.read() always returns immediately but returns -1 if no bytes are in the buffer, don't you?
In your case incomingByte will be 255, so reading will be increased by 207 which probably wasn't intended.
As you don't provide complete code I assume the actual error is in that part of the code you're hiding from us.