#define PIN_LED1 13
void setup(){
pinMode(PIN_LED1, OUTPUT);
// Initialize Serial communication for debugging
Serial.begin(9600);
}
void loop() {
digitalWrite(PIN_LED1, HIGH);
delay(100);
// Read the analog voltage from pin A0
int sensorValue = analogRead(A0);
// Print the raw sensor value to the Serial monitor
Serial.print("Raw Sensor Value: ");
Serial.println(sensorValue);
//converting the sensor value to a voltage
float voltage = sensorValue * (5.0 / 1023.0);
// Assuming a 5V reference voltage
Serial.print("Voltage: ");
Serial.print(voltage);
Serial.println(" V");
// Delay for a second
digitalWrite(PIN_LED1, LOW);
delay(400);
}