Adding a light sensor service to the NXT
Hi,
I have completed all the tutorials and all that, but am still a newbie with MSRS.
My problem is I'm trying to use my NXT light sensors (connected to port 1 and 2 on my NXT). I can't seem to get it congifured correctly though.
I tried looking through the \samples\Platforms\LEGO\NXT\LegoNXTServices\LegoNXTLightSensor.cs
to see how to do it from there, but I'm not getting it.
Also how come on the LegoNXTLightSensor.cs does it use the
Microsoft.Robotics.Services.AnalogSensor.Proxy;
instead of the
Microsoft.Robotics.Services.LegoNxt.LightSensor.Proxy;
?
My current project that I'm trying to use this with has the sonar configured correctly, and has the motors configured correctly (I'm basing my project of Tutorial4 which has the windows form for controlling the robots motors via the drive)
I have some code working with the light sensor. I can send it to you through email if you want, just let me know.
I have tried using the LegoNxt.LightSensor.Proxy instead of the AnalogSensor.Proxy, but nothing seems to change. I think they use analog instead because it is a more generic service and can be used for sensors other than the specific Lego light sensor.
However, using the example in the LegoNXT folder, I seem to get inaccurate readings from the light sensor. All of my readings are around 30, not the 1-100 range I would expect. Does anybody else know what causes this, or a way to get around it?
I just sent you an email with an archive of my program. Extract the entire folder into your sample directory.
I hope my code helps you with your question, and if you can figure out why I'm getting seemingly inaccurate readings, I would love to hear from you. Hooray for teamwork!