Page 1 of 4

NXC: NXT 2.0 color sensor in lamp mode

Posted: 03 Jan 2011, 06:42
by timpattinson
Hi.
I'm wondering if anyone knows how to turn on the light on the nxt 2.0 color sensor (not the HT sensor) in NXC?
Tim

Re: NXC: NXT 2.0 color sensor in lamp mode

Posted: 03 Jan 2011, 07:50
by mattallen37
I use the following to select mode, and therefore setting the LED control.

Code: Select all

SetSensorColorRed(S1);  //Turn on Red
SetSensorColorGreen(S1);//Turn on Green
SetSensorColorBlue(S1); //Turn on Blue
SetSensorColorFull(S1); //Turn on all (multiplexed, so not at the same time, thus reducing brightness)

Re: NXC: NXT 2.0 color sensor in lamp mode

Posted: 03 Jan 2011, 07:52
by timpattinson
Thanks. I just didn't know that that did it
Thanks again
Tim.

Re: NXC: NXT 2.0 color sensor in lamp mode

Posted: 03 Jan 2011, 07:54
by timpattinson
How do you turn them off?
Thanks
Tim

Re: NXC: NXT 2.0 color sensor in lamp mode

Posted: 03 Jan 2011, 08:37
by mattallen37
NP. I can only assume, but try using the following to turn it off.

Code: Select all

SetSensorColorNone(S1);

Re: NXC: NXT 2.0 color sensor in lamp mode

Posted: 03 Jan 2011, 08:39
by timpattinson
Thanks. ;)
-Tim

Re: NXC: NXT 2.0 color sensor in lamp mode

Posted: 03 Jan 2011, 09:16
by rghansen
Does anyone know why the calls SetSensorColorFull( colorSensorPort ) and SetSensorColorNone( colorSensorPort ) each take about 170 milliseconds? It seems like a lot of time just to turn a light on and off. I didn't find any waits in the generated code so I assume that this happens in the firmware.

Re: NXC: NXT 2.0 color sensor in lamp mode

Posted: 03 Jan 2011, 10:55
by mightor
This is a firmware/hardware thing and a known issue with this sensor.

- Xander

Re: NXC: NXT 2.0 color sensor in lamp mode

Posted: 03 Jan 2011, 18:19
by mattallen37
mightor wrote:This is a firmware/hardware thing and a known issue with this sensor.

- Xander
You call it an "issue", is it messed up (not how it should be)? what is responsible for the delay? Is it the NXT firmware? the sensor? both? I don't like the delay, but if it is an NXT problem, could it be used that much faster with a u-processor as an NXT co-processor (Arduino, or PICAXE)?

Re: NXC: NXT 2.0 color sensor in lamp mode

Posted: 03 Jan 2011, 19:26
by mightor
I have no idea tbh. One way you could find out is to compare the time it takes with various firmwares :) Use an NXT 1.0 light sensor to measure, it's got a 3ms update time.

- Xander