Hello everyone, I have recently bought i2s mic from adafruit and am trying to simply read the mic and output the readings to serial monitor. I am using I2SInput example from arduino example library. Here is my code:
#include <I2S.h>
I2S i2s(INPUT);
void setup() {
Serial.begin(115200);
i2s.setDATA(4);
i2s.setBCLK(5); // Note: LRCLK = BCLK + 1
i2s.setBitsPerSample(16);
i2s.setFrequency(22050);
// NOTE: The following values are known to work with the Adafruit microphone:
// i2s.setBitsPerSample(32);
// i2s.setFrequency(16000);
i2s.begin();
while (1) {
int16_t l, r;
i2s.read16(&l, &r);
// NOTE: Adafruit microphone word size needs to match the BPS above.
// int32_t l, r;
// i2s.read32(&l, &r);
Serial.printf("%d %d\r\n", l, r);
}
}
void loop() {
/* Nothing here */
}
I have wired mic and board as following:
GND->GND
3V3->3V
D4->DOUT
D5->BCLK
D6->LRCL
From serial monitor I am getting always zeros despite all the noise I am trying to produce. It looks like something does not work properly.
Can anyone tell me what I am doing wrong here? Thanks
3 posts - 2 participants