// Potentiometer is connected to GPIO 34 (Analog ADC1_CH6)
const int potPin = 34;
const int Rref = 658;
const int Vref = 3300;
// variable for storing the potentiometer value
float potValue = 0;
float Rout = 0;
void setup() {
Serial.begin(115200);
delay(1000);
}
void loop() {
// Reading potentiometer value
potValue = analogRead(potPin);
potValue = map(potValue, 0, 4095, 0, Vref);
Rout = (potValue * Rref) / ((Vref / 1000) - (potValue / 1000));
Serial.println(Rout);
delay(500);
}