Back to Step by Step Course by Robojax
If you don't like to see ads while video is being played you can purchase YouTube premium Here
Please select other codes for this lecture from the links below.
We first learn the difference between Analog and digital. Then we learn what is Potentiometer and how to measure DC voltage with Arduino and the how to find the value of resistor.
Using this code you can find unknown R value
/*
* S01-10 Potentiometer R value
Please watch video instruction here https://youtu.be/wuNrzQ8rpYw
This code is available at http://robojax.com/course1/?vid=lecture10
with over 100 lectures Free On YouTube Watch it here http://robojax.com/L/?id=338
Get the code for the course: http://robojax.com/L/?id=339
* Written by Ahmad Shamshiri for Robojax, robojax.com http:youTube.com/robojaxTV
* Feb 23, 2019
*
*/
const int potPin = A0;// pint name for reading voltage
float RT = 10000;// the potentiometer value 10k
float R;// the unknow R value
void setup() {
Serial.begin(9600);// initialize the serial monitor
Serial.println("Reading Analog vlaue");
}
void loop() {
int potValue = analogRead(potPin);// read the input value
float voltage = potValue * (5.0 / 1023.0);// calculate voltage
R = ( voltage * RT)/5.0;// calculate R
Serial.print("R :");
Serial.print(R);
Serial.print(" Ohms V:");
Serial.print(voltage);
Serial.println("V");
delay(200);
}
The least I expect from you is to thumb up the video and subscribe to my channel. I appriciate that. .I have spent months making these lectures and writing code. You don't lose anything by subscribging to my channel. Your subscription is stamp of approval to my videos and more people can find them and in it turn it helps me. Thank you
If you found this tutorial helpful, please support me so I can continue creating content like this. support me via PayPal
**** AFFILIATE PROGRAM **** We are a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for us to earn fees by linking to Amazon.com and affiliated sites.