To control the train at the station were needed two IR leds due to the range and angle of these. One controls the station entry and the other the station exit. To control the position of the train were used two obstacle sensors. One controls the number of laps on the inside track and the other controls the station entry. One difficulty that arises was the train control. LEGO offers the code to interact with their Power Functions (more info here) and there are four ways to interact with the train. Initially i used the Combo PWM but the train stops when exits the IR led range. After some help from the Portuguese lego Community ( Comunidade0936 ) change the functions to the Single Output and the problem was solved.
Each Monday is ArduinoMonday here at Adafruit! Be sure to check out our posts, tutorials and new Arduino related products. Adafruit manufactures the Arduino right here in the United States in cooperation with arduino.cc. We have a huge selection of Arduino accessories and all the code and tutorials to get you up and running in no time!