NXC: NXT 2.0 color sensor in lamp mode

Discussion specific to NXT-G, NXC, NBC, RobotC, Lejos, and more.
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: NXC: NXT 2.0 color sensor in lamp mode

Post 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.
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
ricardocrl
Posts: 117
Joined: 27 Dec 2010, 19:27

Re: NXC: NXT 2.0 color sensor in lamp mode

Post 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?
gloomyandy
Posts: 323
Joined: 29 Sep 2010, 05:03

Re: NXC: NXT 2.0 color sensor in lamp mode

Post 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
ricardocrl
Posts: 117
Joined: 27 Dec 2010, 19:27

Re: NXC: NXT 2.0 color sensor in lamp mode

Post 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?
gloomyandy
Posts: 323
Joined: 29 Sep 2010, 05:03

Re: NXC: NXT 2.0 color sensor in lamp mode

Post 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
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: NXC: NXT 2.0 color sensor in lamp mode

Post 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.
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
Post Reply

Who is online

Users browsing this forum: Semrush [Bot] and 0 guests