Libraries \ Potentiometer

Reference for Wiring version 1.0 Build 0100+ If you have a previous version, use the reference included with your software. If see any errors or have any comments, let us know.

Name

Potentiometer

Examples
#include <Potentiometer.h>

Potentiometer potentiometer = Potentiometer(2); //a Potentiometer at analog in 2

void setup()
{
  Serial.begin(9800);
  Serial.println("Potentiometer example");
  delay(2000);
}

void loop()
{
  Serial.print("potentiometer.getValue() ");
  Serial.println(potentiometer.getValue(),DEC);
  Serial.print("potentiometer.getSector() ");
  Serial.println(potentiometer.getSector(),DEC);
  Serial.println();
  delay(1000);
}
Description Initialize the Potentiometer object and you can specify the number of sectors of it.
Syntax
Potentiometer(potPin)
Potentiometer(potPin, sectors)
Methods
getValue()
getSector()
setSector()
Parameters
potPin byte: the pin this Potentiometer is connected to.
sectors The value for how many sectors you want to divide the potentiometer into.
Returns None
Usage Application
Updated on July 07, 2011 11:11:23pm PDT

Creative Commons License