Analog read pin on the 7" display ESP32 board

edited July 15 in Elecrow HMI Display

Completely new to this display, can someone explain to me how to wire an analog input (0-3 volt)? And is there a simple (demo) sketch for output to the serial monitor?

Comments

  • edited July 16

    Hello @HansTis ,
    To read analog value, you need an ADC pin, but there is no available ADC pin. However, if you don't need to use a speaker, you can use GPIO17 pin as ADC input pin to read analog value.
    Use the following code:
    #define A_pin 17

        void setup()
        {
        setMode(A_pin, INPUT);
        }
    
        void loop()
        {
        int A_value = 0;
        A_value = digitalRead(A_Pin);
        Serial.println(A_value);
        delay(1000);
        }
    
  • Thanks for your advice!

Sign In or Register to comment.