The program was written in Lego’s block language and has 3 main parts
- Button event capture, for capturing the inputs from buttons and changing the target count and motor speed variables
- Distance counter loop, for counting the number of balls passed.
- Motor control loop, for running the conveyor or tipping ramp.
I also setup a control panel with buttons and guages to see what was going on.