This example will guide you through the process of connecting a potentiometer to your imp, and polling its value at a specified interval.
Connect the middle lead of the potentiometer to pin2 on the imp.
Connect one of the outside leads of the potentiometer to the 3v3 pin on the imp.
Connect the other outside lead of the potentiometer to the GND pin on the imp.
In impCentral, create a new Product called “Examples” (if you have not tried another of these basic hardware examples) and a new Development Device Group called “potentiometer”. Assign your device to the new Device Group, then copy and paste the following code into the code editor’s ‘Device Code’ pane and hit ‘Build and Force Restart’.
We can now use pin.read() to get the current voltage of the pin. The result of a pin.read() on an ANALOG_IN pin will be an integer value between 0 and 65,535 (212).