MindSqualls
Would you like to react to this message? Create an account in a few clicks or log in to continue.

NXT Color Sensor

2 posters

Go down

NXT Color Sensor Empty NXT Color Sensor

Post  alan Thu Sep 15, 2011 1:46 pm

Hi, i m new to NXT and mindsquall.
First of all, thanks very much for such a great library saving me plenty time study Lego spec.

I have a small question about color sensor, is there any way to turn on the white LED light source? i check the NxtColorSensor class but cant found any.

Thanks!

alan

Posts : 2
Join date : 2011-09-15

Back to top Go down

NXT Color Sensor Empty Re: NXT Color Sensor

Post  Niels Fri Sep 16, 2011 5:05 pm

The NXT2 color sensor does not have a white led. Instead it has a hole with three colored leds behind: red, green and blue (and a lens before them). You can turn them on one at a time, or all tree at the same time. The last option should in theory give a whitish light, but looks more like three overlapping colored circles.

The sensor has two modes – it can function as a color sensor or it can function as a light sensor.

In the color sensor mode, all the three leds are turned on. And so to answer to your question, set it into this mode and ignore the sensor-part:

Code:
NxtBrick brick = new NxtBrick(NxtCommLinkType.Bluetooth, 3);
Nxt2ColorSensor sensor = new Nxt2ColorSensor();
brick.Sensor1 = sensor;

sensor.SetColorDetectorMode();

brick.Connect();
To turn the light off again:

Code:
sensor.SetLightSensorMode(Nxt2Color.Black);
You can also turn on the tree lights individually:

Code:
sensor.SetLightSensorMode(Nxt2Color.Green);
The code looks like this, because turning the lights on/off is a function of how the sensor is being used ... as a sensor.

I agree that this is not very intuitively when you just want to use the sensor as a lamp. I think that I will add some extra methods for this in the next version.

Niels

Posts : 19
Join date : 2011-07-15

Back to top Go down

NXT Color Sensor Empty Re: NXT Color Sensor

Post  alan Fri Sep 16, 2011 9:24 pm

Thanks very much, it is helpful.

At first i was looking at the Color sensor, there are 3 led/sensor like component. Just wonder what they actually use for.

alan

Posts : 2
Join date : 2011-09-15

Back to top Go down

NXT Color Sensor Empty Re: NXT Color Sensor

Post  Niels Sat Sep 17, 2011 9:29 am

Everything you didn't know you wanted to know about the NXT2 color sensor:

http://botbench.com/blog/2011/09/16/exposed-lego-colour-sensor/

Niels

Posts : 19
Join date : 2011-07-15

Back to top Go down

NXT Color Sensor Empty Re: NXT Color Sensor

Post  Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum