From 2c5d06993f2464437fb54e20b91b8c1593c5dfd6 Mon Sep 17 00:00:00 2001 From: ladyada Date: Sat, 12 Oct 2019 01:53:27 -0400 Subject: [PATCH] fix demo to work with CPB --- .../PDM/examples/PDMSerialPlotter/PDMSerialPlotter.ino | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libraries/PDM/examples/PDMSerialPlotter/PDMSerialPlotter.ino b/libraries/PDM/examples/PDMSerialPlotter/PDMSerialPlotter.ino index 977a3835..1c966a38 100644 --- a/libraries/PDM/examples/PDMSerialPlotter/PDMSerialPlotter.ino +++ b/libraries/PDM/examples/PDMSerialPlotter/PDMSerialPlotter.ino @@ -12,7 +12,7 @@ // The default Circuit Playground Bluefruit pins // data pin, clock pin, power pin (-1 if not used) -PDMClass PDM(33, 34, -1); +PDMClass PDM(24, 25, -1); // buffer to read samples into, each sample is 16-bits short sampleBuffer[256]; @@ -41,13 +41,13 @@ void setup() { void loop() { // wait for samples to be read - if (samplesRead) { + PDM.IrqHandler(); + if (samplesRead) { // print samples to the serial monitor or plotter for (int i = 0; i < samplesRead; i++) { Serial.println(sampleBuffer[i]); } - // clear the read count samplesRead = 0; } @@ -62,4 +62,4 @@ void onPDMdata() { // 16-bit, 2 bytes per sample samplesRead = bytesAvailable / 2; -} +} \ No newline at end of file