This program makes the Swing Game - LEGO SPIKE Prime robot move the two LEGO figures based on input from their respective controllers.
The color sensor controller uses the colored plate above it to determine movement. If the sensor detects blue, the LEGO figure moves forward. If it detects purple, the figure moves backward. Any other color will make it stop.
The motor controller works similarly. If the motor turns more than 30 degrees forward, the LEGO figure moves forward. If it turns more than 30 degrees backward, the figure moves backward. If it stays within that range, the figure stops.
The goal of the game is for both LEGO figures to reach the center without tipping the swing to either side. Good luck—and have fun!