Last night I was experimenting with and motors and transistors. I was testing out NPN and PNP transistors to learn more about how they work and how I can use microcontrollers to control the speed with PWN. I was having some issues, including the transistors getting very hot, but the most confusing part of the night was when I turned the transistor around and the circuit still seemed to function the same. I thought transistors allowed current flow in only one direction. Maybe I am wrong about this?
A NPN transistor basically is a stack of three differently doped areas of a semiconductor. The first is N-doped, the middle P-doped and the last N-doped.
So yes, on the first sight, you can swap collector and emitter, and the transistor might still work. But there's more magic: A real transistor is optimized to fulfill its specs when connected correctly, i.e. the interior is not symmetric. If you swap C and E, you get a new transistor with completely different specs, which you don't know. It's also easy to overload and destroy the transistor by swapping C and E.
An anecdote: When I was about 10, I built my first circuits, and also started to etch PCBs. My first try was an astable multivibrator with two LEDs, and the PCB layout was absolutely mirror symmetric. The circuit worked, but the one LED was ten times longer on than the other. It turned out I had mirrored the second transistor with respect to the first, i.e. accidentally I swapped C and E. This caused the strange behavior, and after removing and soldering the second transistor, the circuit did what it should.
As Bart suggested, I'm assuming by backwards, you mean the emitter and collector are switched. Yes current can flow in both directions.
An NPN transistor backwards is also an NPN. There will still be a reverse beta, however, the backwards NPN transistor won't work as well as a correctly oriented one will. It's not recommended.
You're thinking of diodes when talking about allowing current to go in one direction; however, at a certain reverse bias (negative breakdown voltage), the diode will let current through even though it is placed backwards in the circuit.