View Source APDS9960 (apds9960 v0.3.1)

Use APDS9960 color, proximity and gesture sensor in Elixir.

Link to this section Summary

Functions

Reads the color data.

Reads new gesture engine results, deduces gesture and returns the direction of the gesture.

Reads the proximity data. The proximity value is a number from 0 to 255 where the higher the number the closer an object is to the sensor.

Link to this section Types

Specs

gesture_direction() :: :up | :down | :left | :right

Link to this section Functions

Link to this function

color(sensor, opts \\ [])

View Source

Reads the color data.

# To get a color measurement, first enable the color engine.
APDS9960.enable_color(sensor)

APDS9960.color(sensor)

See APDS9960.Sensor.enable/2.

Link to this function

gesture(sensor, opts \\ [])

View Source

Specs

gesture(APDS9960.Sensor.t(), Enum.t()) :: gesture_direction() | {:error, any()}

Reads new gesture engine results, deduces gesture and returns the direction of the gesture.

# To get a gesture result, first enable both the proximity engine and gesture engine.
APDS9960.enable(sensor, :gesture)
APDS9960.enable(sensor, :proximity)

APDS9960.gesture(sensor, timeout: 5000)

See APDS9960.Sensor.init/1.

Link to this function

proximity(sensor, opts \\ [])

View Source

Reads the proximity data. The proximity value is a number from 0 to 255 where the higher the number the closer an object is to the sensor.

# To get a proximity result, first enable the proximity engine.
APDS9960.enable(sensor, :proximity)

APDS9960.proximity(sensor)

See APDS9960.Sensor.reset!/1.

See APDS9960.Sensor.set_defaults!/1.

See APDS9960.Sensor.status/1.