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 ...
It is not possible to increase the sensitivity of the touch sensor in-programming. Generally, you can use a lever to decrease the amount of force required.
Here the "load" is the touch sensor button, the "effort" is the ball hitting the lever, and the beam is a lego beam.
If the ball you're using is too light, you still probably won't be able to ...
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 ...
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 ...
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 ...
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 ...
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...
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 ...
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.
Hitechnic.com now points to modernroboticsinc.com. You can find the Hitechnic EV3 color sensor block here:
All available downloads are available and searchable here:
Perhaps you need to add some hysteresis in your sensor loops. Each loop waits for a condition to be met, but then repeats infinity as long as that condition is met. Hysteresis means waiting for another condition to indicate that the sensor has returned to the original state and usually includes a deadband (meaning the positive trigger is not the same as the ...
Yes, a switch statement is present in EV3-G.
Such statement would look like this:
However, the only colors you can switch against are black, blue, green, yellow, red, white and brown (the basic lego colors). So unfortunately no orange.
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. ...