void setup() { // Initialize serial communication at 9600 baud rate Serial.begin(9600); // Configure A2 as an input (optional, as analogRead handles this) pinMode(A2, INPUT); } void loop() { // Read the raw analog value from A2 (0-1023) int sensorValue = analogRead(A2); // Convert the raw value to voltage (assuming 5V reference voltage) float voltage = sensorValue * (5.0 / 1023.0); // Print the voltage to the serial monitor Serial.print("A2 Voltage: "); Serial.print(voltage); Serial.println(" V"); // Wait for a short period before the next reading delay(500); // 500 ms }