Use Potentiometer Module on Arduino

Intro: Use Potentiometer Module on Arduino

Potentiometer module using a rotary potentiometer, potentiometer knob that can be changed to adjust the potentiometer resistance.

Step 1: Hardware List and Wiring Ddiagram

Hardware list

Arduino UNO *1

Rotary potentiometer  *1

Male to Female Dupont Line *3

Wiring Diagram as shown:

Step 2: Test Code


int sensorPin = A0;
int ledPin = 13;
int sensorValue = 0;

void setup() {
  pinMode(ledPin, OUTPUT); 
  Serial.begin(115200);
}

void loop() {
  sensorValue = analogRead(sensorPin);
  Serial.println(sensorValue); 
  //Serial.write(sensorValue);
  digitalWrite(ledPin, HIGH); 
  delay(100);         
  digitalWrite(ledPin, LOW);  
  delay(100);                 
}

Step 3: Test Result

By adjust Rotary Potentiometer‘s knob, we can see Arduino A0′s value changed, as shown

Share

    Recommendations

    • Audio Contest 2018

      Audio Contest 2018
    • Furniture Contest 2018

      Furniture Contest 2018
    • Metalworking Contest

      Metalworking Contest

    Discussions