Main Content


Read gesture through APDS9960 sensor

Since R2021b

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


[readGesture,timestamp] = readGesture(apds9960obj) returns the gesture readings as an enumeration constant. The possible values for the enumeration constant are none, up, down, left, or right. Timestamp is optional.


Read Gesture from Sensor

Create an Arduino object.

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

Create the sensor object for the sensor.

apds9960obj = apds9960(arduinoobj)
[gesture, timestamp] = readGesture(apds9960obj)

The gesture enum returns the gesture.

gesture = Gestures enumeration

timestamp = datetime
   17-Jun-2021 13:25:38

Input Arguments

collapse all

APDS9960 sensor connection, specified as a apds9960 sensor object.

Output Arguments

collapse all

The gesture readings can be none, left, right, up, or, down.

Data Types: enum

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

Version History

Introduced in R2021b