The color sensor works pretty well as long as the object is about 1 1/2- 2 modules from the object.
The sensing is best when the object is flat.
The object is large enough to be fully contained within the "spotlight" that the sensor emits. As long as this is true, it doesn't really matter what the background color is.
Another thing to consider is that ...
One way of doing this is using a loop and interrupting it.
How it works:
The "Loop Interrupt" block stops all blocks running inside of the loop, so by interrupting the loop after either wait block, it will stop the other wait block. The type of loop doesn't actually matter because we never reach that point. I chose to wait for "Logic" with a value of "...
When you take a Raw value from any sensor, the EV3 brick passes on the reading as reported directly from the sensor, without doing any processing. Especially for the color sensor, where you have several modes such as Reflection and Color Number, the EV3 brain does do post-processing on the input value to make the output easier to understand and/or use. By ...
The Original Mindstorms NXT only came with the NXT Light Sensor. The NXT Light Sensor cannot detect colors, so this is most likely what you have. You can currently purchase the NXT Color Sensor from Bricklink.com for under $30.
Based on this API reference and this discussion of the color sensor it looks like "pct" is short for percent as in a ratio with 100.
David added in a comment:
EV3 hardware developer kit provides a bit more info on what 100% means:
The output from the sensor within light sensor mode is a value between 0 – 100 where 0 equals no reflected light ...
To understand how to use the data, it help to understand how the color sensor works. Let's take a step back for a minute and have a look. The sensitive electrical component here is just a photodiode or phototransistor that lets us measure light intensity.
If we turn all of the LEDs off we are just measuring ambient light. If we turn on just one of the LEDs ...
The returned values are the reflected light intensities for each of the three LED colors (red/green/blue).
The scale is actually 0-1023. Basically, this is the raw value returned by a 10-bit analog to digital converter in the color sensor (2 ^ 10 = 1024).
The LEDs themselves may not put out enough light that you could ever reach the maximum value, so you ...
You may try to use the color sensor in RGB mode using a 3rd party block found here: http://mindcuber.com/mindcub3r/mindcub3r.html#ColorSensorRGBBlock
With this block you get a set of three 0-255 values, one for each R G B color. It will still be tricky to correctly classify the color of your objects as the readings are noisy - you can try to set ranges to ...
The color of the LED on the LEGO EV3 Color Sensor depends on which mode it is in.
From the EV3 help file:
When the Color Sensor is in Color mode, red, green, and blue LED lights on the front of the sensor will turn on.
REFLECTED LIGHT INTENSITY MODE
When the Color Sensor is in Reflected Light Intensity mode, a red ...
Looking at the stack trace in the exception you've posted, the error seems to be coming from a call to RemoteEV3.createRegulatedMotor:
at lejos.remote.ev3.RemoteEV3.createRegulatedMotor(Unknown Source)
After that it's just going through the motions to try and open a port on a remote device...
Having a ...
Not sure what language you are using, or calls you are making before this, but:
float var_Min = var_R; if (var_G > var_Min) var_Min = var_G; if (var_B > var_Min) var_Min = var_B;
Should be (note the use of < rather than >)
float var_Min = var_R; if (var_G < var_Min) var_Min = var_G; if (var_B < var_Min) var_Min = var_B;
Your posted code is ...
Green does tend to be tricky on the LEGO EV3 Color sensor. Example
Here are some suggestions:
Build a shroud to eliminate ambient light. I have seen people use electrical tape for this or build something from LEGO parts.
Using the raw RGB values, convert to HSV (there is a link in Example 1 for this).
Use the algorithm for the NXT color sensor from the EV3 ...
There will certainly be some mechanical and robotics questions that you'll need to figure out, such as where on the car to position the sensors, and how to ensure that the car is reliably reading both colors at every intersection. (Which brings up contextual questions like "are there discrete intersections?")
From a programming perspective, 49 possible ...
The loop does stop but you can not see it: You should add a brake block after the loop that runs until colour sensor<20 otherwise there is no visible indication that the loop has stopped. Hope this helped.
I believe that this is the block that you are looking for:
The database listing downloads appears to be down, but the files are still available. Here's what I did to find the internal link:
Pull up the download listings on archive.org:
Thank you! The answer from jncraton did the trick.
Summary: the direct download for the EV3 sensor block for the HiTechnic Color Sensor V2 is here:
The zip archive includes three files:
(1) instructions (HTColorREADME.txt)
(2) the control block (HTColor.ev3b)
(3) a sample file demonstrating use ...
Light sensors are mainly affected by three independent variables:
Distance between the sensor and the surface
Color of the surface
Amount of ambient light
What this means is, in order to measure one of these things, the other two variables must be held constant. So, in order to measure color, the distance must be constant and the ambient light ...
Since you are trying to solve a Rubik's cube, check out the source code for the MindCuber. The solution there is that the values are not actually converted into colors. Rather the raw values are converted to HSV and then sorted by hue. The actual value does not matter, just how close it is to the other values.
The Mindcuber also has a white calibration. ...