Error #5 when compiling Arduino Uno code

I have been working on some code, and to enable me to see what was happening, I did a serial print to the serial monitor. At one point I was able to do 4 print statements and then when I attempted to add another I got the error. The only way I could get it to compile was to comment out the additional print statements. As I tried various thing so I would be able to display an additional variable I got to the point where it would only compile if there were 2 or less statements. This makes no sense to me at all. Has anyone else had this problem or know what might be causing it or how to avoid it. I have seen the same error code before and someone pointed to something on the internet that indicated adding a Serial.print() statement would sometimes help or do something with a global variable. At that time it had to do with number of “if” statements and the Serial.print() statement helped. I am new to Arduino programming and could be overlooking something obvious but it sure doesn’t feel like it.


From your description, it sounds like you are mainly having Arduino programming issues. You should consider posting about your issue on the Arduino Forum so that your question can reach a larger community, one that focuses specifically on Arduino.

If you want to keep troubleshooting here, can you post a screenshot of the error message that you are getting and your code? It is difficult to determine where in your code is causing the problem without seeing it and the error message.

- Amanda

Thanks Amanda, I will check it out.