This block works for EV3 and Ruby Robot!
The Get Color block allows you to sample the data from the robot's color sensors, which can be configured to point in different directions: straight ahead, facing the sides, or even facing the ground (allowing the robot to identify lines or follow routes drawn on the floor).
The color sensor can distinguish between several colors, which are either available in a drop-down menu inside a designated data Color block, or can be inserted into the Wait Until block as string values:
Note: when using the String data block, the color name must be capitalized. If we use "green", the color sensor would not respond!
When in Reflection Value mode, the color sensor emits a beam of light and measures the intensity of the light reflected back to it in numerical values between 0 (black) and 100 (white) .
This makes the Color Sensor get Reflection Value method ideal for line following using Proportional Control, as it allows for a wide range of values and thus finer control.
Both Color Name and Reflection Value data is displayed in the HUD: