APDS-9960 Light Sensor
This documentation includes installation guidelines and sample code for your hardware.
Windows 10 IoT Core Library
APDS9960Sensor library is responsible for communicating with the APDS-9960 sensor.
To use the library, add the following using statement to the top of your C# code.
Then, create an instance of the APDS9960Sensor class.
Now you're ready to access the library by calling the apds instance.
Initialization
APDS9960Sensor
Initiates the APDS-9960 sensor to get ambient light, RGB light, proximity and gesture direction.
Parameters
Bool ambientAndRGBLightEnabled: Ambient light and RGB light sense.
Bool proximityDetectionEnabled: Proximity detection.
Bool gestureRecognitionEnabled: Gesture recognition. (Not implemented.)
Basic Members
Read Ambient Light
Reads the ambient light value.
Parameters
None
Returns
Int: Ambient light.
Read RGB Light
Reads the RGB light values.
Parameters
None
Returns
Int[]: Red, green and blue light values respectively.
Read Proximity
Reads the proximity value.
Parameters
None
Returns
Int: Proximity value.
Disposal
To clean up the resources used by the class, call the Dispose() method it when the application is closing.
This method stops the timers and cleans the resources used by the class.
Samples
You can copy the example codes from https://github.com/Turta-io/IoTHAT/tree/master/Samples/Windows10IoTCore address. There are two examples of this library.
APDS9960 Ambient Light Sample App
This application demonstrates reading ambient light from the sensor.
To run the example:
Open the sample project you downloaded.
Make sure "ARM" is selected from the solution platforms selection.
Deploy the sample to the Raspberry Pi using the "F5" key.
Sample Code
Result
When you run the sample, it prints the ambient light reading to the Visual Studio Output / Immediate Window.
To stop the application, use the "Stop" button on the Visual Studio.
APDS9960 RGB Light Sample App
This application demonstrates reading RGB light from the sensor.
To run the example:
Open the sample project you downloaded.
Make sure "ARM" is selected from the solution platforms selection.
Deploy the sample to the Raspberry Pi using the "F5" key.
Sample Code
Result
When you run the sample, it prints the RGB light readings to the Visual Studio Output / Immediate Window.
To stop the application, use the "Stop" button on the Visual Studio.
Last updated