Potentiometer With Arduino

This tutorial is about basics of potentiometer and how to use it with arduino and read data with the help of Serial monitor.  

What is potentiometer ? 
In easy Words potentiometer is variable resistance. it means we can change the value of resistance with rotary (by rotating the knob). there are so many types of potentiometers. 

potentiometer is easy to learn, learn more Here : 

Arduino With potentiometer : 

here is connect one end of pot to ground and other to +5V of arduino and middle pin to Analog pin A0 of Arduino As shown in circuit diagram.

Code : 





int potpin = A0;
int val ;

void setup() {
Serial.begin(9600);
pinMode(potpin,INPUT);
}

void loop() {
val = analogRead(potpin);
Serial.print("Potentiometer Value is : ");
Serial.println(val);
}

Post a Comment

Previous Post Next Post