Reference   Language | Libraries | Comparison | Changes

PDM : PDM class

available()

Description

Get the number of bytes available for reading from the PDM interface. This is data that has already arrived and was stored in the PDM receive buffer.

Syntax

PDM.available()

Parameters

None

Returns

The number of bytes available to read

Example


// buffer to read samples into, each sample is 16-bits
short sampleBuffer[256];

// number of samples read
volatile int samplesRead;

// …

  // query the number of bytes available
  int bytesAvailable = PDM.available();

  // read into the sample buffer
  PDM.read(sampleBuffer, bytesAvailable);

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.