Knowledge Base

Get Color Name/Reflection Value Block

output-onlinepngtools__231_.png This block works for EV3 and Ruby Robot! output-onlinepngtools__101_.png

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 Get Color block supports two different methods of color identification: 
Color Name
Reflection Value

Color Name 

The color sensor can distinguish between nine different colors, identified as string values:

"Black" , "White" , "Red" , "Yellow" , "Green" , "Cyan" , "Blue" , "Magenta" , "Brown" .

Notethe string values must be capitalized. If we use "green", the color sensor would not respond!



Reflection Value 

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:


Was this article helpful?
0 out of 0 found this helpful


Please sign in to leave a comment.

Powered by Zendesk