Arduino MEGA won't use serial unless plugged into PC

Hey,

So I'm having trouble getting any Arduino to send or receive serial communication when not plugged into my PC with the port selected. Even so, I have to upload the code each time after trying to power it externally.

What happens is that it will work when plugged into the PC (the TX is rapidly flashing because the code is sending nonstop), but when I power it externally with any 5V adapter (power via usb or barrel), all serial function stops. This is the point where I have to refresh it by uploading the code again. I've tried sketches that I've used before, which I know work, and I'm having the same exact results, even over multiple boards (new ones and ones I've been using).

Is there some setting that I'm not thinking of or what? Any input on this is appreciated, thanks!

What are you trying to communicate with when the Mega is not connected to the PC?

How do you know (apart from flashing lights) that it is not working?

Post your program.

...R

For the “4-Button IO”, an MP3 Trigger. None of the MP3 Triggers are responding.

For the “Jump Time”, an Arduino Metro M0 Express. The Metro isn’t receiving anything because it displays number received greater than 0. All numbers being transmitted from the MEGA are greater than 0.

4-Button_IO.ino (6.51 KB)

Jump_Time_Prototype_Matrix_Displays02.ino (3.34 KB)

I've only looked briefly at your shorter program.

It's not at all clear what you are trying to do. What is the Mega sending 't' to? How is the something connected to the Mega?

If you have something other than the PC that is receiving Serial messages from your Mega why not connect it to Serial1 ?

Have you a GND connection between the "something" and the Mega?

This code
Serial.write("t");

should be

Serial.write('t');

Single quotes for single characters.

...R