Locomotive directional lighting
You need to create a bridge rectifier using the common-cathode LED and two other diodes:







simulate this circuit &ndash; Schematic created using CircuitLab

The red LED is lit when A is positive with respect to B. The yellow LED is lit in the opposite case. Build 6 of these; hook three of them up one way at one end of the locomotive, and hook the other three up in the other way at the other end.

R1 sets the current through the LEDs; a value of 390 &Omega; provides about 30 mA, and it needs to be rated for at least 1/2 W. Use a higher value if the LEDs are too bright at this current.

If you haven't done so already, you can do something similar with the headlights:







simulate this circuit