Potentiometer

A potentiometer acts as a variable resistor. By rotating the shaft on the potentiometer, you'll see how it takes effect. Here's a simple example:

  1. Connect two ends of the potentiometer to 3.3V and GND of the LinkIt 7697 board.

  2. Connect the output pin (the one in the middle of the pot) to P14 (A0) of the board.

  3. Copy and paste the codes below into the Arduino IDE:

void setup() { 
    Serial.begin(9600); 
} 
 
void loop() { 
    int value = analogRead(A0); 
    
    Serial.print("Input voltage: "); 
    // LinkIt 7697 ADC spec: 12-bit, 0~2.5V range 
    Serial.print(value * 2500 / 4095); 
    Serial.println("mV"); 
 
    delay(100); 
}

4. Click the Upload icon to compile and upload the sketch to the board.

Then open the serial monitor (with baud rate 9,600) and you'll see the voltage change as you rotate the shaft, for example:

Last updated