#define analogInPin 34
int sensorValue = 0;        // value read from the pot
int LED = 02; //pin LED

void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
  Serial.println("Hello, ESP32!");

  pinMode(analogInPin, INPUT); // Potentiometer pin
  pinMode (LED, OUTPUT);// pin LED como SALIDA
  digitalWrite(LED, LOW);// turn off LED just in case

}

void loop() 
{
   sensorValue = analogRead(analogInPin);//lectura sensor
   Serial.println(sensorValue);//100
   delay(100);

if (sensorValue >=  2000 )//si es mayor que el umbral
  {
    digitalWrite (LED, HIGH);//prendo led
    Serial.println("high");
  }
  else if (sensorValue <  2000 )//si es menor que el umbral
  {
    digitalWrite (LED, LOW);//apago led
    Serial.println("down");
  }
  Serial.println(sensorValue);//100
 
}