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 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 +}