Search code examples
esp32adctoit

Using Pin 26 for ADC?


Using pin 26 for ADC seems to be discouraged in Toit.

From what I can see on https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/adc.html pin 26 should have an ADC converter, so what is the reason for that?


Solution

  • The ESP32 is limited around ADC2:

    Since the ADC2 module is also used by the Wi-Fi, only one of them could get the preemption when using together, which means the adc2_get_raw() may get blocked until Wi-Fi stops, and vice versa.

    Therefore I suggest using ADC1-pins if WiFi is used for connectivity.