const float voltageRef = 3.3; // ESP32 reference voltage (3.3V)
const float adcResolution = 4095.0; // ESP32 ADC resolution (12-bit: 0–4095)
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("Hello, ESP32!");
//pinMode(26, INPUT);
analogReadResolution(12);
}
void loop() {
// put your main code here, to run repeatedly:
delay(10); // this speeds up the simulation
int analogValue = analogRead(26);
Serial.println("Analog sensor reading:");
Serial.println (analogValue);
float voltage = (analogValue / adcResolution) * voltageRef;
float temperatureC = voltage * (-80.0);
Serial.print("After convert to Temperature (Celcius): ");
Serial.print(temperatureC);
Serial.println(" °C");
delay(1000);
}