#define PinEntrada 34
#define PinLed 25
int sensor = 0;
int lectura = 0;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("Hello, ESP32!");
pinMode(PinEntrada, INPUT);
pinMode(PinLed, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
lectura=analogRead(PinEntrada);
sensor = map(lectura,0,4095,0,255);
Serial.print("Lectura: ");
Serial.print(lectura);
Serial.print(" -> PWM: ");
Serial.println(sensor);
analogWrite(PinLed, sensor);
}