Lego Train Controller

We were tasked with getting one lego train to follow another lego train (both powered by arduino) at a precise distance behind it, but we couldn’t control the speed of the first lego train. My partner and I implemented a PID controller on the second lego train to accomplish this.

Simulink Model: