Using print statements to troubleshoot code

I am using the Arduino Mega as the controller for a robot I am working on. I want to use print statements to print various information while the robot is driving around. Is there any way to print to the Serial Monitor or EEPROM and then connect to the board with my computer and read the information it has printed?

Thanks in advance

Serial.begin(), Serial.print() and Serial.println() warrant consideration.

Use an SD card and write to that, or use a long usb cable, or use RFM12B/Xbee/Nordic NRF24 or any other wireless thingie.

Are you wanting to monitor it in real time, or log the data, then download it later? From your statement, it seems like the latter, but I think clarification is needed (given PaulS's response).

Note that if it is the former, then something akin to Serial.print() would work (although you might have to come up with your own implementation for a wireless means); if the latter, though, there may not be enough room in EEPROM to log the information (depending on how much you are logging and how often - though a Mega has a ton more room than the Uno). You would need some metrics on this to determine whether there is or not (and also know how large your code is that is on the Mega).

If you don't think there is enough room, then you can use an SD card shield or the like, and log the data to the card.

With either method, you would need to code a routine to pull the data from EEPROM (or the SD card), and dump it out the serial monitor with Serial.print(); note that if you are using an SD card, though, you could pop it out, and use a reader (text editor, likely) on your computer to read the file "offline" from the robot instead.

I remember some days ago I read something about SD cards having a 200ms or so write delay now and then (it was in a thread about a ChibiOS port for Arduino). Therefore I was wondering if spreading "save-to-sd" print statements around could become dangerous for time-sensitive operations... Just thinkng out loud.

I do want to log the data. It seems that the easiest way to do so will be to just get a long USB cable and save the output of the serial monitor.

Thanks for the replies.