diff --git a/examples/arduino-rx/arduino-rx.ino b/examples/arduino-rx/arduino-rx.ino index f56516f..506edd2 100644 --- a/examples/arduino-rx/arduino-rx.ino +++ b/examples/arduino-rx/arduino-rx.ino @@ -261,6 +261,11 @@ void loop() { // Main loop .. while (true) { while (qsize >= samplesPerFrame) { + // Use this with the serial plotter to observe real-time audio signal + //for (int i = 0; i < samplesPerFrame; i++) { + // Serial.println(sampleBuffer[qhead + i]); + //} + // We have enough captured samples - try to decode any "ggwave" data: auto tStart = millis(); diff --git a/examples/esp32-rx/esp32-rx.ino b/examples/esp32-rx/esp32-rx.ino index 99dd0f4..75e3d4b 100644 --- a/examples/esp32-rx/esp32-rx.ino +++ b/examples/esp32-rx/esp32-rx.ino @@ -328,15 +328,15 @@ void loop() { size_t bytes_read = 0; i2s_read(i2s_port, sampleBufferRaw, sizeof(TSampleInput)*samplesPerFrame, &bytes_read, portMAX_DELAY); - int samples_read = bytes_read/sizeof(TSampleInput); - if (samples_read != samplesPerFrame) { + int nSamples = bytes_read/sizeof(TSampleInput); + if (nSamples != samplesPerFrame) { Serial.println("Failed to read samples"); return; } #if defined(MIC_ANALOG) // the ADC samples are 12-bit so we need to do some massaging to make them 16-bit - for (int i = 0; i < samples_read; i += 2) { + for (int i = 0; i < nSamples; i += 2) { auto & s0 = sampleBuffer[i]; auto & s1 = sampleBuffer[i + 1]; @@ -350,14 +350,14 @@ void loop() { #endif #if defined(MIC_I2S) || defined(MIC_I2S_SPH0645) - for (int i = 0; i < samples_read; ++i) { + for (int i = 0; i < nSamples; ++i) { sampleBuffer[i] = (sampleBufferRaw[i] & 0xFFFFFFF0) >> 11; } #endif } // Use this with the serial plotter to observe real-time audio signal - //for (int i = 0; i < samples_read; i++) { + //for (int i = 0; i < nSamples; i++) { // Serial.println(sampleBuffer[i]); //} diff --git a/examples/rp2040-rx/fritzing-sketch.fzz b/examples/rp2040-rx/fritzing-sketch.fzz new file mode 100644 index 0000000..7da0721 Binary files /dev/null and b/examples/rp2040-rx/fritzing-sketch.fzz differ diff --git a/examples/rp2040-rx/fritzing-sketch_bb.png b/examples/rp2040-rx/fritzing-sketch_bb.png new file mode 100644 index 0000000..2931282 Binary files /dev/null and b/examples/rp2040-rx/fritzing-sketch_bb.png differ diff --git a/examples/rp2040-rx/rp2040-rx.ino b/examples/rp2040-rx/rp2040-rx.ino index d8aa1fe..7c2b421 100644 --- a/examples/rp2040-rx/rp2040-rx.ino +++ b/examples/rp2040-rx/rp2040-rx.ino @@ -203,7 +203,7 @@ void loop() { int nSamples = samplesRead; samplesRead = 0; - //// loop through any new collected samples + // Use this with the serial plotter to observe real-time audio signal //for (int i = 0; i < nSamples; i++) { // Serial.printf("%d\n", sampleBuffer[i]); //}