Reference   Language | Libraries | Comparison | Changes

ArduinoAPDS9960 : APDS class

proximityAvailable()

Description

Check if a proximity reading is available from the senor. The proximity reading can be retrieved using the APDS.readProximity() function.

This function also enables the proximity sensor when called for the first time.

Syntax

APDS.proximityAvailable()

Parameters

None

Returns

1 if a proximity has been read, otherwise 0

Example


  // check if a proximity reading is available
  if (APDS.proximityAvailable()) {
    int proximity = APDS.readProximity();

    Serial.println(proximity);
  }

See Also



Reference Home

Corrections, suggestions, and new documentation should be posted to the Forum.

The text of the Arduino reference is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.