#09. Input from a Potentiometer

Note This is a web-version of a tutorial chapter embedded right into the XOD IDE. To get a better learning experience we recommend to install the desktop IDE or start the browser-based IDE, and you’ll see the same tutorial there.

Another ubiquitous source of values is a potentiometer (or simply “pot” for short). It is very handy to adjust some parameters smoothly.

There is a special node pot to read values from a potentiometer. You will find it in the xod/common-hardware library.

Patch

Test circuit

Circuit

↓ Download as a Fritzing project

How-to

  1. Add the pot node to your patch.
  2. Set the PORT pin value on the pot node to A0 if you have connected the potentiometer to Arduino port A0 as shown above.
  3. Link the pot node VAL pin to input pins of nodes to control.

Screencast

In our example, if you turn the potentiometer knob, it will affect the brightness of the LEDs. Depending on the angle of the knob, the pot node returns a value from 0.0 to 1.0 to the VAL pin, and that value is transferred to the LUM pins of both LED nodes.

Next lesson →

Found a typo or mistake? Want to improve the text? Edit this page on GitHub and open a pull request. If you have a complex proposal or you want to discuss the content, feel free to start a new thread on XOD forum.