Other Arduino Codes and Videos by Robojax

Reading Potentiometer Voltage using ESP32 Microcontroller

دروس آردوینو به فارسی

Reading Potentiometer Voltage using ESP32 Microcontroller from Analog pins

This this video how to start read potentiometer voltage at Alanog inputs of ESP32. Pins explained, potentiometer explained

Arduino Code


 /*
  ESP32 Analog Read
  Read potentiometer voltage at different inputs

  Written by Ahmad Shamshiri at 20:55
  on Sunday Sep 01, 2019 in Ajax, Ontario, Canada

  Watch Video instruction for this sketch: 
https://youtu.be/UXKu2Xtwj7c
 
*/

const int potPin = 39;// Analog pin

int potValue;// do not change
float voltage =0;// do not change


void setup() {
  // initialize serial communication at 115200 bits per second:
  Serial.begin(115200);
}


void loop() {
  // read the input on analog pin potPin:
  potValue = analogRead(potPin);
  voltage = (3.3/4095.0) * potValue;
  Serial.print("potValue:");
  Serial.print(potValue);
   
  Serial.print(" Voltage:");
  Serial.print(voltage);
  Serial.println("V");  
  delay(50); // delay in between reads for stability
}
   

If you found this tutorial helpful, please support me so I can continue creating content like this. support me via PayPal