Reference   Language | Libraries | Comparison | Changes

PDM : PDM class

setBufferSize()

Description

Set the buffer size (in bytes) used by the PDM interface. Must be called before PDM.begin(...), a default buffer size of 512 is used if not called. This is enough to hold 256 16-bit samples.

Syntax

PDM.setBufferSize(size)

Parameters

size: buffer size to use in bytes

Returns

Nothing

Example


  PDM.setBufferSize(1024);

  // initialize PDM with:
  // - one channel (mono mode)
  // - a 16 kHz sample rate
  if (!PDM.begin(1, 16000)) {
    Serial.println("Failed to start PDM!");
    while (1);
  }

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.