#define ADC_PIN 36
#define ADC_RESOLUTION 4096.0
#define R1 7500
#define R2 30000
#define REF_VOLT 3.3
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("Hello, ESP32!");
// set the ADC attenuation to 11 dB (up to ~3.3V input)
// analogSetAttenuation(ADC_11db);
}
void loop() {
// put your main code here, to run repeatedly:
float adc_val = (float) analogRead(ADC_PIN);
Serial.println(adc_val);
float volt_adc = (REF_VOLT * adc_val) / ADC_RESOLUTION;
Serial.println(adc_val);
float volt_read = volt_adc * ((R1 + R2) / R1);
Serial.print("Measured Voltage = ");
Serial.println(volt_read, 2);
delay(3000); // this speeds up the simulation
}