fix demo to work with CPB

This commit is contained in:
ladyada committed 2019-10-12 01:53:27 -04:00
1 parent b9d586b56c
commit 2c5d06993f
1 file changed
+4 -4
@@ -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;
}
}