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.

Class

Potentiometer

Name

setSector()

Examples
#include <Potentiometer.h>
#include <LED.h>

LED ledBelow = LED(12); //object LED below  at digital 12
LED ledAbove = LED(13); //object LED above  at digital 13
Potentiometer potentiometer = Potentiometer(2);       //a Potentiometer at analog in 2

void setup()
{
  potentiometer.setSectors(2); //split the Potentiometer into two sectors
}

void loop()
{
  if (potentiometer.getSector()==0)
  {
    ledBelow.on();
    ledAbove.off();
  }
  else
  {
    ledBelow.off();
    ledAbove.on();
  }
}
Description Set the current sector of the Potentiometer.
Syntax
setSectors(newSectors)
Parameters
newSectors The number of sectors of this Potentiometer.
Returns None
Usage Application
Updated on July 07, 2011 11:11:24pm PDT

Creative Commons License