I2S.h: No such file or directory [fixed]
System: MacOS Silicon
If anyone got the error "I2S.h: No such file or directory", just install the esp32 version 2.0.17 to fix it.
"Navigate to Tools > Board > Boards Manager..., type the keyword esp32 in the search box, select the latest version of esp32, and install it." It seems the latest version do not have this header file or the header file has changed to other name?
I ran the command: arduino-cli core install esp32:[email protected] and got the following output:
Error during install: Platform 'esp32:[email protected]' not found: required version 2.0.17 not found for platform esp32:esp32
How do I fix this?
Any solution with this? I got same error on windows10
I ran the command:
arduino-cli core install esp32:[email protected]and got the following output:Error during install: Platform 'esp32:[email protected]' not found: required version 2.0.17 not found for platform esp32:esp32How do I fix this?
Any solution with this? I got same error on windows10
Follow the readme: Add ESP32 board package to your Arduino IDE: Navigate to File > Preferences, and fill "Additional Boards Manager URLs" with the URL: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
I think you might have not add the "ESP32 board package" yet.
[email protected] is fine,but [email protected] or [email protected] doesn't work;because i2s library is changed into esp_i2s;
I ran the command:
arduino-cli core install esp32:[email protected]and got the following output:Error during install: Platform 'esp32:[email protected]' not found: required version 2.0.17 not found for platform esp32:esp32How do I fix this?
Any solution with this? I got same error on windows10
Follow the readme: Add ESP32 board package to your Arduino IDE: Navigate to File > Preferences, and fill "Additional Boards Manager URLs" with the URL: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
I think you might have not add the "ESP32 board package" yet.
I solved it by following the steps, as well as installing the latest Arduino-cli @1.0.1
Here is an update for anyone who wants to migrate their project to the latest platform
[email protected] is fine,but [email protected] or [email protected] doesn't work;because i2s library is changed into esp_i2s;
change firmware.ino from i2s.h to esp_i2s.h, or stay on [email protected] 😄
[email protected] is fine,but [email protected] or [email protected] doesn't work;because i2s library is changed into esp_i2s;
change firmware.ino from i2s.h to esp_i2s.h, or stay on [email protected] 😄
Here's the diff to get it to compile with ESP_I2S. Need to do further testing though:
index ca000b02..454ce97c 100644
--- a/OpenGlass/firmware/firmware.ino
+++ b/OpenGlass/firmware/firmware.ino
@@ -1,5 +1,5 @@
#define CAMERA_MODEL_XIAO_ESP32S3
-#include <I2S.h>
+#include <ESP_I2S.h>
#include <BLE2902.h>
#include <BLEDevice.h>
#include <BLEUtils.h>
@@ -9,6 +9,10 @@
#include "camera_pins.h"
#include "mulaw.h"
+I2SClass I2S;
+
+
+
// Audio
// Uncomment to switch the codec
@@ -287,28 +291,28 @@ static size_t compressed_buffer_size = recording_buffer_size + 3; /* header */
#endif
#endif
-static uint8_t *s_recording_buffer = nullptr;
+static char *s_recording_buffer = nullptr;
static uint8_t *s_compressed_frame = nullptr;
static uint8_t *s_compressed_frame_2 = nullptr;
void configure_microphone() {
// start I2S at 16 kHz with 16-bits per sample
- I2S.setAllPins(-1, 42, 41, -1, -1);
- if (!I2S.begin(PDM_MONO_MODE, SAMPLE_RATE, SAMPLE_BITS)) {
+ I2S.setPins(-1, 42, 41, -1, -1);
+ if (!I2S.begin(I2S_MODE_STD, SAMPLE_RATE, I2S_DATA_BIT_WIDTH_16BIT, I2S_SLOT_MODE_MONO)) {
Serial.println("Failed to initialize I2S!");
while (1); // do nothing
}
// Allocate buffers
- s_recording_buffer = (uint8_t *) ps_calloc(recording_buffer_size, sizeof(uint8_t));
+ s_recording_buffer = (char*) ps_calloc(recording_buffer_size, sizeof(uint8_t));
s_compressed_frame = (uint8_t *) ps_calloc(compressed_buffer_size, sizeof(uint8_t));
s_compressed_frame_2 = (uint8_t *) ps_calloc(compressed_buffer_size, sizeof(uint8_t));
}
size_t read_microphone() {
size_t bytes_recorded = 0;
- esp_i2s::i2s_read(esp_i2s::I2S_NUM_0, s_recording_buffer, recording_buffer_size, &bytes_recorded, portMAX_DELAY);
+ bytes_recorded = I2S.readBytes(s_recording_buffer, recording_buffer_size);
return bytes_recorded;
}