Download Project as SVG
Ini
[env:seeed_xiao_esp32s3] platform = espressif32 board = seeed_xiao_esp32s3 framework = arduino monitor_speed = 115200 lib_deps = adafruit/Adafruit SSD1306@^2.5.13 adafruit/Adafruit GFX Library@^1.11.11
Cpp
#include <Arduino.h> #include <Wire.h> #include <Adafruit_GFX.h> #include <Adafruit_SSD1306.h> #include "driver/i2s.h" #define PIN_I2C_SDA 5 #define PIN_I2C_SCL 6 #define PIN_I2S_BCLK 7 #define PIN_I2S_MIC_DOUT 8 #define PIN_I2S_AMP_DIN 9 #define PIN_I2S_LRCLK 44 #define PIN_TOUCH_OUT 1 #define PIN_POT_ADC 2 #define OLED_ADDR 0x3C #define SCREEN_WIDTH 128 #define SCREEN_HEIGHT 64 Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1); void setupI2S() { // Placeholder I2S setup: exact duplex/audio routing depends on final firmware architecture. // Use ESP-IDF I2S std driver or Arduino audio library when implementing real audio pass-through/playback. } void setup() { Serial.begin(115200); delay(500); pinMode(PIN_TOUCH_OUT, INPUT); pinMode(PIN_POT_ADC, INPUT); Wire.begin(PIN_I2C_SDA, PIN_I2C_SCL); if (!display.begin(SSD1306_SWITCHCAPVCC, OLED_ADDR)) { Serial.println("OLED not found"); } else { display.clearDisplay(); display.setTextSize(1); display.setTextColor(SSD1306_WHITE); display.setCursor(0, 0); display.println("Smart Glasses"); display.println("XIAO ESP32-S3"); display.display(); } setupI2S(); Serial.println("Init complete"); } void loop() { int touchState = digitalRead(PIN_TOUCH_OUT); int potRaw = analogRead(PIN_POT_ADC); Serial.printf("touch=%d pot=%d\n", touchState, potRaw); display.clearDisplay(); display.setCursor(0, 0); display.println("Smart Glasses"); display.printf("Touch: %d\n", touchState); display.printf("Pot: %d\n", potRaw); display.display(); delay(250); }
Platform
platformio.ini
main.cpp
Notes