Main Content

readProximity

Read the proximity from APDS9960 sensor

Since R2021b

Add-On Required: This feature requires the MATLAB Support Package for Arduino Hardware add-on.

Description

[proximity,timestamp] = readProximity(apds9960obj) returns one reading of the proximity value with the timestamp. Timestamp argument is optional.

Examples

Read Proximity from Sensor

Create an Arduino object.

arduinoobj = arduino('COM4', 'Nano33BLE', 'Libraries', 'APDS9960');

Create the sensor object for the sensor in use.

apds9960obj = apds9960(arduinoobj)

Return one sample of the proximity data.

proximReadings = readProximity(apds9960obj)
proximReadings = 0.9647

Input Arguments

collapse all

APDS9960 sensor connection, specified as a apds9960 sensor object.

Output Arguments

collapse all

Proximity value read from the sensor, ranges from 0 and 1 with 0 being the most proximal.

Data Types: double

The time at which MATLAB® receives the proximity data from the sensor, specified as a datetime.

Version History

Introduced in R2021b