Decodes train control messages sent by a Märklin 6021 model train controller (among others).
You cannot connect an Arduino directly to the track - the signal is alternating ±10V, which would most likely damage an Arduino's 0-5V input pins. Instead, use something like the following:
Tested on an Arduino NG with an Atmega168 - where the track input must be connected on pins 2 or 3, as those are the only pins with interrupt support.
See this comprehensive explanation of the Märklin-Motorola protocol (also available in German).