🦀 ClawHub
ESP32
by @ivangdavila
Avoid common ESP32 mistakes — GPIO conflicts, WiFi+ADC2 trap, deep sleep gotchas, and FreeRTOS pitfalls.
TERMINAL
clawhub install esp32📖 About This Skill
name: ESP32 description: Avoid common ESP32 mistakes — GPIO conflicts, WiFi+ADC2 trap, deep sleep gotchas, and FreeRTOS pitfalls. metadata: {"clawdbot":{"emoji":"📟","os":["linux","darwin","win32"]}}
GPIO Restrictions
Deep Sleep
RTC_DATA_ATTR for persistent variables — regular RAM lost in deep sleepesp_sleep_enable_ext0_wakeup() for single pin — ext1 for multiple pinsWiFi Gotchas
WiFi.mode() before WiFi.begin() — mode affects behaviorWiFi.setAutoReconnect(true) doesn't always work — implement reconnect in loopWiFi.onEvent() more reliable — don't poll WiFi.status()FreeRTOS
vTaskDelay() or feed watchdogxTaskCreatePinnedToCore() for core affinity — WiFi on core 0, your code on core 1delay() yields to scheduler — vTaskDelay(pdMS_TO_TICKS(ms)) in tasksMemory
ESP.getFreeHeap() for monitoring — log periodically in long-running appsheap_caps_malloc(size, MALLOC_CAP_SPIRAM)reserve() or char arraysPeripherals
analogWrite() — use LEDC: ledcSetup(), ledcAttachPin(), ledcWrite()SPI.begin() doesn't auto-configureOTA Updates
ESP.getFreeSketchSpace() — OTA fails silently if not enough spaceArduinoOTA blocks during update — handle in loop, not in time-critical codePower
esp_brownout_disable() if using battery