Serial.print only prints garbage
(Uncomplete) list of possible causes:
- Does your code contain instructions like digitalWrite( 1, xxx)?
Sorry but Pin-1 is being used for serial transmission (TX).
- Did you port your Arduino to a standalone board and
are using a quartz with something different than 16 MHz?
- Check your Serial monitor: does the baud rate shown at the bottom right corner match the value given with Serial.begin() ?
- Are you using a lot of String operations in your program?
If you are concatenating strings the resulting string has to be allocated somewhere in memory. That might lead to errors. To avoid this, if you know the maximum length of the resulting string before just define your string with some initial characters and replace them by using
setCharAt(position, newChar) .
- Could it be your program is running out of memory? Adding the Serial to your code will consume another 186 bytes of SRAM memory.
Check with the freeRam() function.
See error03.html or
for further details.
There is no garbage collection in the Arduino system.
- Are you printing from inside an ISR (interrupt service routine) ? Most of the functions are not reentrant.