Back-and-forth train control by Arduino with IR sensor

The train gets to an end of track (and IR sensor detects it), the train goes back, and so on.
It’s composed of as followings:

Arduino UNO
Arduino Motorshield
IR sensor module x2
Indicator LED

01 : http://ardutrain.blogspot.nl/2013/06/back-and-forth-train-control-by-arduino.html