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!
Stop breadboarding and soldering – start making immediately! Adafruit’s Circuit Playground is jam-packed with LEDs, sensors, buttons, alligator clip pads and more. Build projects with Circuit Playground in a few minutes with the drag-and-drop MakeCode programming site, learn computer science using the CS Discoveries class on code.org, jump into CircuitPython to learn Python and hardware together, or even use Arduino IDE. Circuit Playground Express is the newest and best Circuit Playground board, with support for MakeCode, CircuitPython, and Arduino. It has a powerful processor, 10 NeoPixels, mini speaker, InfraRed receive and transmit, two buttons, a switch, 14 alligator clip pads, and lots of sensors: capacitive touch, IR proximity, temperature, light, motion and sound. A whole wide world of electronics and coding is waiting for you, and it fits in the palm of your hand.