Serial Flush

Hi. New to Arduino-Uno and have a start up book by John Boxall. Have loaded a program for the serial monitor to multiply numbers. When I enter a number it does the calculation and then prints another equation that I have not entered. Also pressing various keys on the laptop brings different characters than pressed. The start up book is dated 2013 and as I understand the serial. Flush command have gone through a change since the book was written. Have tried to research the problem but there seems to be a lot of conflicting solutions. Any help welcome.

Hi, not new to Arduino and don't have your book, so can't see your code.

Don't forget to use code tags.

Apparently, in very early version of Arduino, Serial.flush() would empty the receive buffer. But for quite some time now, it has instead waited for the transmit buffer to be emptied. If you need to empty the receive buffer, use:

while (Serial.available());

Ray L.