Page 4 of 4

Re: NXC: NXT 2.0 color sensor in lamp mode

Posted: 15 Feb 2011, 23:35
by mattallen37
I did the test with NXC, but I used a light sensor instead of the color sensor to determine the times. The color sensor update speed might be too much in sync with the other one's flashing light, and perhaps that is why you had the issue reading the flashing light. Using a light sensor (like I did) there wouldn't be that issue.

Re: NXC: NXT 2.0 color sensor in lamp mode

Posted: 16 Feb 2011, 10:35
by ricardocrl
Even though, it is strengh that I never get a value bigger than 7..8 percent. If it is a matter of sampling rate, I should get sometimes higher values and I don't.

BTW, does anyone knows what is the sample rate of the color sensor? I would guess that it is the same as the Light sensor, ~3ms, because it's still an analog sensor. The only thing that changes from the light sensor is the coloring LED possibilities. Well, I would say that the only sample rate that is slower is in COLORFULL mode, because it has to do 3 measures and some calculations.

It's just a blind shot. Any other guesses?

Re: NXC: NXT 2.0 color sensor in lamp mode

Posted: 16 Feb 2011, 11:34
by gloomyandy
The sample rate for the color sensor hardware is actually much higher, it is not a standard analogue sensor. It uses the ARM a2d inputs not the Avr a2d. However I think the standard firmware will only actually read the sensor values every 1ms so that is the sample rate you will see... When you use full color mode the firmware will perform all 3 readings one after the other (in the same 1ms period) so you should see the same sample rate for full color and for single color... Note that these timings are for reading the sensor values (which is fast), not switching modes (which is slow!).

Andy

Re: NXC: NXT 2.0 color sensor in lamp mode

Posted: 16 Feb 2011, 12:44
by ricardocrl
That is a very good new! Thanks a lot for the information! :-)

I'm curious, how did you get that information? By firmware inspection?

Re: NXC: NXT 2.0 color sensor in lamp mode

Posted: 16 Feb 2011, 21:00
by gloomyandy
Yes I've spent a lot of time reading the Lego firmware. I also implemented the leJOS version of the color sensor driver...

Andy

Re: NXC: NXT 2.0 color sensor in lamp mode

Posted: 16 Feb 2011, 22:08
by mattallen37
ricardocrl wrote:Even though, it is strengh that I never get a value bigger than 7..8 percent. If it is a matter of sampling rate, I should get sometimes higher values and I don't...
But, if the NXT reads the one (sensor) at the same time that the other is in transition (between colors), and it is always in sync, that would explain the low readings. Try using a second NXT to read it, that way they won't be in sync.