LEGO® Powered Up custom train control

Free code guide to create a customizable control interface for trains in the Powered Up app

The train controller interface of the Powered Up 3.0 app allows now to have multiple hubs connected, but it does not offer a convenient interface to control these trains the same time.

This guide provides 2 code variations with the following abilities using the slider control interface of the Powered Up app:

Simple interface

  • Control 2 trains with the 2 sliders
  • Control the lights of the 2 trains separately with 2 buttons
  • Stop button to stop all trains
  • Interface can be customized to control more trains/motors with one slider, e.g. coupled trains

Advanced interface

  • Control 4 trains with the left slider
  • Switch between the trains with the right button
  • Left number shows the speed of the current train, right number shows the train selected
  • Left button toggles the light of the currently selected train
  • Middle button stops the currently selected train

Disclaimer: the code in the downloadable pdf guide is experimental, not fully complete nor foolproof. It is created considering the limitations of the Powered Up 3.0 app. I’m sure it can be programmed in a more effective way, this is my approach that you can use as a baseline for your own solution.

Advertisements

Comments are closed.