Reference   Language | Libraries | Comparison | Changes

ArduinoAPDS9960 : APDS class

colorAvailable()

Description

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

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

Syntax

APDS.colorAvailable()

Parameters

None

Returns

1 if a color has been read, otherwise 0

Example


  // check if a color reading is available
  if (APDS.colorAvailable()) {
    int r, g, b;

    // read the color
    APDS.readColor(r, g, b);

    …
  }

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.