How to use RGB to detect 2 colors at the same time


I’m working on a project and have been stuck on mbock5 code for a solution on this:

I am using a RGB sensor at the moment to follow a black line, can i also use RGB to code the following and if so how:

  1. to detect a color and move in the direction of the color at a 4 way intersection of a black line. So the bot moves on a black line (using the RGB sensor) and if it senses a green color block on the left of the intersection, it should then turn left and continue on teh black line on the left, otherwise go straight. If it sees a green block on the right side of the intersection, then it should turn right and follow the green line on the right, otehrwise go straight.

Apprecaite a speedy response as we are coding for a competition. many thanks.


Is it RGB line follower sensor or the RGB led sensor?