From f3b6f488bcb6c72354bc17fed3f1ef31a1203ee4 Mon Sep 17 00:00:00 2001 From: Sreeram Rave <62308557+SpiderDerp@users.noreply.github.com> Date: Tue, 1 Jul 2025 21:32:24 -0400 Subject: [PATCH 1/2] Update README.md MISO and MOSI are referred to as DO and DI on the sd card module now. --- examples/iot/esp32/voice_led_controller/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/iot/esp32/voice_led_controller/README.md b/examples/iot/esp32/voice_led_controller/README.md index 3745153d3..89285b574 100644 --- a/examples/iot/esp32/voice_led_controller/README.md +++ b/examples/iot/esp32/voice_led_controller/README.md @@ -26,8 +26,8 @@ This Arduino-based application demonstrates how to capture audio from a micropho * **SD Card Adapter -> ESP32** * CS -> IO5 * SCK -> IO18 - * MOSI -> IO23 - * MISO -> IO19 + * MOSI/DI -> IO23 + * MISO/DO -> IO19 * VCC -> 3.3V * GND -> GND From 0a0637931d4a20a1c5d7a6b6acc42ca0bc2180aa Mon Sep 17 00:00:00 2001 From: Sreeram Rave <62308557+SpiderDerp@users.noreply.github.com> Date: Tue, 1 Jul 2025 21:35:23 -0400 Subject: [PATCH 2/2] Add content-length header to http request + record audio only when button is pressed --- examples/iot/esp32/voice_led_controller/led_controller.ino | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/examples/iot/esp32/voice_led_controller/led_controller.ino b/examples/iot/esp32/voice_led_controller/led_controller.ino index c227362ac..645a9c1b0 100644 --- a/examples/iot/esp32/voice_led_controller/led_controller.ino +++ b/examples/iot/esp32/voice_led_controller/led_controller.ino @@ -305,7 +305,8 @@ void sendAudio() { file.close(); SD.end(); // Close the SD connection after reading the file - int httpCode = http.POST(jsonString); + http.addHeader("Content-Length", String(strlen(jsonString))); //http requests require Content-Length header to prevent http 411 error + int httpCode = http.POST((uint8_t*)jsonString, strlen(jsonString)); free(jsonString); Serial.print(F("Http code: ")); Serial.println(httpCode); @@ -418,7 +419,7 @@ void setup() { } void loop() { - if (digitalRead(BUTTON_PIN) == LOW) { + if (digitalRead(BUTTON_PIN) == HIGH) { //check if button is pressed digitalWrite(LED_PIN, HIGH); // This delay is to debounce the button and allow time to speak @@ -430,4 +431,4 @@ void loop() { createAudioJsonRequest(); sendAudio(); } -} \ No newline at end of file +}