#define LED 15
#define pot_1 2
#define pot_2 4
int valPot_1 = 0;
int valPot_2 = 0;
void setup() {
pinMode(LED, OUTPUT);
Serial.begin(115200);
Serial.println("Hello, ESP32!");
}
void loop() {
valPot_1 = analogRead(pot_1);
valPot_2 = analogRead(pot_2);
double percPot1 = valPot_1 * 100/4095;
double percPot2 = valPot_2*100/4095;
double diferenca = percPot1-percPot2;
delay(250);
printf("\n %f %f ", percPot1, percPot2);
if(percPot1-percPot2 > 10 || percPot2-percPot1 > 10){
analogWrite(LED, HIGH);
}
else{
analogWrite(LED,LOW);
}
}