Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/iot/esp32/voice_led_controller/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
7 changes: 4 additions & 3 deletions examples/iot/esp32/voice_led_controller/led_controller.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -418,7 +419,7 @@ void setup() {
}

void loop() {
if (digitalRead(BUTTON_PIN) == LOW) {
if (digitalRead(BUTTON_PIN) == HIGH) { //check if button is pressed
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the diagram there's a pull down resistor with the button - guessing you're using a different setup? This will likely change for people depending on what button they're using.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I followed the diagram with the pull-down resistor and the button, but the recording that is supposed to occur upon button press only worked for me when I modified this line. Otherwise, it would record when the button is not being pressed.
It could be possible that I made a wiring mistake, so feel free to ignore this change.

digitalWrite(LED_PIN, HIGH);

// This delay is to debounce the button and allow time to speak
Expand All @@ -430,4 +431,4 @@ void loop() {
createAudioJsonRequest();
sendAudio();
}
}
}