// Task 2: ADC using Thermistor (Analog Temperature Sensor)
const int sensorPin = A0; // Thermistor connected to A0
const float BETA = 3950; // Beta Coefficient of the thermistor
void setup() {
Serial.begin(9600);
analogReference(DEFAULT); // Use 5V reference initially
}
void loop() {
// Read analog input (0–1023)
int analogValue = analogRead(sensorPin);
// Convert ADC value to temperature in Celsius using the Beta formula
float celsius = 1 / (log(1 / (1023.0 / analogValue - 1)) / BETA + 1.0 / 298.15) - 273.15;
// Print results
Serial.print("ADC Value: ");
Serial.print(analogValue);
Serial.print(" | Temperature: ");
Serial.print(celsius);
Serial.println(" °C");
delay(1000);
}