Reference   Language | Libraries | Comparison | Changes

PDM : PDM class

setGain()

Description

Set the gain value used by the PDM interface.

Syntax

PDM.setGain(gain)

Parameters

gain: gain value to use, 0 - 255, defaults to 20 if not specified.

Returns

Nothing

Example


  // optionally set the gain, defaults to 20
  PDM.setGain(30);

  // 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.