// Define the pin where the potentiometer is connected
#define POT_PIN A0 // GP26 corresponds to ADC0
void setup() {
// Initialize serial communication at 9600 baud rate
Serial1.begin(9600);
}
void loop() {
// Read the analog value from the potentiometer
int analogValue = analogRead(POT_PIN);
// Convert the analog value (0-4095) to voltage (0-3.3V)
float voltage = analogValue * (3.3 / 1023.0);
// Print the analog value and the corresponding voltage to the Serial Monitor
Serial1.print("Analog Value: ");
Serial1.print(analogValue);
Serial1.print(" | Voltage: ");
Serial1.print(voltage);
Serial1.println(" V");
// Wait a bit before the next loop
delay(500);
}