analogRead can't work with blynk iot

When i use analogRead function with blynk iot
Its give zero value (analogRead ) dont work with librarie of blynk iot

Do you think we can help you without your code?

Let me guess, you are trying to read one of these pins:
0, 2, 4, 12, 13, 14, 15, 25, 26 or 27

Pete.

1 Like

Yeah!!

It’s not a fault with the Blynk library, it’s a limitation of the ESP32 architecture.

The ESP32 has two Analog to Digital Converters (ADCs) and one of these (ADC2) cannot be used at the same time as WiFi.

Because Blynk uses WiFi you need to choose analog pins that are connected to ADC1 when you’re using an ESP32 with Blynk - but the same applies to any IoT system which uses WiFi on the ESP32.

These are the ADC1 Analog pins that can be used at the same time as WiFi…

  • ADC1_CH0 (GPIO 36)
  • ADC1_CH1 (GPIO 37)
  • ADC1_CH2 (GPIO 38)
  • ADC1_CH3 (GPIO 39)
  • ADC1_CH4 (GPIO 32)
  • ADC1_CH5 (GPIO 33)
  • ADC1_CH6 (GPIO 34)
  • ADC1_CH7 (GPIO 35)

Note that pins 34-39 are input only (not an issue if you’re just trying to read the analog input values, but it’s difficult to tell if that’s what you intend, based on the info you’ve provided).

You can read more about this and other ESP32 features/limitations here…

Pete.

2 Likes

Thank you for everything :heart::pray:

1 Like