He used an IR sensor it detects colors and then he coded the same... He added a delay of that switch according to the belt speed and then he used the command of making it go back to the normal ones. The same can be used in industrial automation where we need to differentiate between good and bad backets. Those who have bad colors we can just remove it from the belt