Arduino Mega gets Very HOT when connected to NPN transistors

Hello

The processor gets hot when i connect NPN transistors to outputs. The transistors bases are connected to arduino outputs.

Do I need resistors or diode in between bases and outputs?

Yes, you NEED a base resistor, to limit the pin current.
Tell us what/how you have connected things.
Leo..

just resistors? not diodes?

leigrei:
just resistors? not diodes?

Yes you need just resistors.

The value depends on the type of transistor and it's collector current.
1k is a general value, but it could be wrong for what you're doing.
We need more info if you want good advice.
Leo..

Minimum resistor value about 150 ohms. You may have fried the output pins doing this and/or
the transistor. Bipolar transistors need to be fed a given current and Arduino pins shouldn't be
made to ever source 40mA or more (25mA is a more reasonable working maximum, "absolute
maximum" values are just that).

If the transistor is being used as a switching transistor (it will be), then you'll get 10 to 20 times
the base current from the collector at most in proper saturation, so don't expect to be able
to switch more than 500mA this way. For more you need a MOSFET or darlington.

the transistors and arduino are OK, they work but they get hot

leigrei:
the transistors and arduino are OK, they work but they get hot

BUT you are damaging them, they will not work like they did and they will soon fail.

If you are not prepared to take advice then why post the question?