Main Site Documentation

Reading light sensor data


#1

I recently purchased the Lynx S4 and started experimenting with some of the code samples I found in CodeShare and other posts in this forum.

I have the drivers installed and can read the basic device information (ports, s/n, description, etc) from my C# apps. My question, how do I read the lighsensor that ships with the Lynx Green kit? Can I find a code sample that demonstrates this? How about other tutorials?

Thanks,
Scott


#2

The LightSensor uses an AnalogInput. You’ll have to talk to the analog chip on the Lynx over I2C to get a reading. Its address is 0x49 and is the ADS7830.

Though if you use the beta SDK we released last week, all of that is done for you, though it requires using C++ at the moment. Just create an instance of the light_sense module and call read_percentage().