NXT 2.0 color sensor ambient light detector
Brought to you by:
afanofosc,
afanofosc_99
I am unable to get the ambient light detector working from the NXT 2.0 kit. I've tried the following code:
task main()
{
SetSensor(S1, SENSOR_TOUCH);
SetSensorLowspeed(IN_4);
SetSensorColorFull(S3);
ClearScreen();
while(1)
{
int light = SENSOR_3;
string temp = NumToStr(light);
TextOut(0, LCD_LINE1, temp);
}
}
I've tried varying the setup function to:
SetSensorLight(S3, false)
SetSensorLight(S3, true)
SetSensorLowSpeed(S3);
How do I read the ambient light sensor from the NXT 2.0 kit?
// configure the sensor to not have a lamp on
SetSensorColorNone(S3);
// later
// now read the color sensor scaled value
int light = SENSOR_3;