RX and TX line not working when connected to the barrel

Anybody had this problem before?

Yep but it depends on more than a simple statement like yours.

Which board ?
What else is connected to the board ?
How is it connected ? etc etc.

Oh and probably another half dozen questions to be able to comprehend what your actual problem is ?

Most of the UNO's use 0 and 1 as the TX RX pins so if anything else is connected before the sketch is loaded into the board there will often be issues.

Or TX and RX are reversed is another common failure instead of RX to TX and vice versa.

ballscrewbob thanks for the response

is the MEGA2560
I have a the 5V connected to the breadboard from that I have connected 3 things

  1. 2 of this TTL to RS232 connected to serial 3 and serial 2.
    2)also a waterproof temperature sensor on pin 12.

everything worked when in usb connected but as soon as I put it trough the power barrel it doesn't. Any ideas?

So you are feeding the Mega from a 5V supply off the breadboard.

What is the max current of the 5V supply and where on the Mega are you feeding it to ?

Could be that you need slightly more current or the point you used for Vin on the Mega is not correct or requires slightly more voltage to get the voltage regulator on the Mega to work correctly.

EDIT

BTW if you are using one of those cheap Chinese breadboard adaptors to feed the Mega then beware that I have had a few of those fail when too much current is pulled from them and it could result in an over voltage to the attached equipment.

I'm feeding in a power supply 12v 1 Amp and arduino is currently taking 195mA. I'm not close to the limit. Measure the voltage in the breaboard and is 4.56V

So I take it you are using some form of regulation to reduce the 12V down to 5V for the breadboard ??

What is the breadboard regulation capable of for current as chances are it wont be 1 Amp the same as the supply ??

Although 195mA should be within the reach of most 5V regulators.

Still pretty sure you should be applying more than 5 V to the barrel for the Mega's regulator to kick in properly and swap from the USB side power regulation properly.

Feeding 5V into the Mega: has to go into the USB connector, or has to go into the 5V pin on the power header.
Connecting to the barrel jack or to Vin will cause too much voltage drop with 5V feeding into the 5V regulator - you won't see 5V coming out, and the Mega needs 4.5V to 5.5V to run correctly.