// Potentiometer is connected to GPIO 34 (Analog ADC1_CH6)
const int potentiometerPin = 34;
// variable for storing the potentiometer value
int potentiometerValue = 0;
float potentiometer_Vout = 3.3;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
pinMode(potentiometerPin, INPUT);
Serial.println("Hello, Indah Putri Agustina!");
}
void loop() {
potentiometerValue = analogRead(potentiometerPin); // Reading potentiometer value
float MCU_Vin = (potentiometer_Vout * potentiometerValue)/4096; // MCU ADC Resolution 12 bit
Serial.print(potentiometerValue);
Serial.print(":");
Serial.println(MCU_Vin);
delay(300);
}