At the start of June there is a small LEGO railway show at the Buckinghamshire Railway Centre. The first year I went I did a display of LEGO pneumatic engines which I really enjoyed building. This year I have decided to bite the bullet and do something train related! Dont worry, I am not going to the dark side.
Below is a simple train demo which uses the LEGO Mindstorms NXT to control 2 9volt trains. I actually really enjoyed creating this, all I need to do now is actually make some trains!
This has been programmed in RobotC and uses 2 light sensors and 2 touch sensors to detect and stop the train. NXT motor port A powers the main track loop. NXT motor port B and C power the part of the track that comes off the points as they are isolated. So if NXT motor port A & B are on, train 1 will move. If NXT motor port A & C are on, train 2 moves.
Please let me know if you would like further information.