Chapter 28 – Experiment 20 – POTENTIOMETER

This example will teach you how to use a potentiometer.

The potentiometer is a simple knob that provides a variable resistance, which can be read by the micro-controller as an analog value. You can imagine to have an infinite number of resistors that based on the knob are returning a different resistance value. By turning the shaft of the potentiometer, the the amount of resistance is changed. The central pin is used for read the analog value of the potentiometer.

The breadboard:

20 - POTENTIOMETER

The schema:

20 - potentiometer (1)

Finally, the code:

int sensorPin = A0; // select the input pin for the potentiometer
int ledPin = 13; // select the pin for the LED
int sensorValue = 0; // variable to store the value coming from the sensor
void setup()
{ // declare the ledPin as an OUTPUT:
   pinMode(ledPin, OUTPUT);
}
void loop()
{ // read the value from the sensor:
  sensorValue = analogRead(sensorPin);
  // turn the ledPin on
  digitalWrite(ledPin, HIGH);
  // stop the program for <sensorValue> milliseconds:
  delay(sensorValue);
  // turn the ledPin off:
  digitalWrite(ledPin, LOW);
  // stop the program for for <sensorValue> milliseconds:
  delay(sensorValue);
}

5 comments

  1. Only make sure that you purchase only real Konad products.

    This will prevent the foil from sticking onto unwanted areas.
    Aliya Farooqs Signature Salon is one such parlour that
    provides numerous designs.

  2. It’s in point of fact a nice and helpful piece of information.
    I’m glad that you shared this helpful info with us.
    Please stay us up to date like this. Thank you for sharing.

  3. The voip Independent on Sunday, in which she portrays
    an archaeologist who finds romance with a musician.
    The airport’s own website has a voip section which explains their own parking
    spaces because everyone has their private cars. Short stay parking is available at a
    much cheaper rate than you could have an pleasant experience.
    The Dallas Morning News reports that through July of
    this year. There’s more than just a pair of black stilettos and
    designer sunglasses.

    My web site business phone line free installation

  4. Thanks , I’ve recently been looking for info approximately this subject for ages and yours is
    the greatest I have came upon so far. However, what concerning the
    bottom line? Are you positive in regards to the supply?

  5. When someone writes an article he/she maintains the thought of a
    user in his/her mind that how a user can understand it. So that’s why this paragraph is perfect.
    Thanks!

Leave a Reply to prezzi occhiali da vista ray ban Cancel reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>


istanbul evden eve nakliyat istanbul evden eve nakliyat istanbul evden eve nakliyat sarıyer evden eve nakliyat beylikdüzü evden eve nakliyat şişli evden eve nakliyat