Reading a Slider

Slider potentiometer

Widely used in sound mixers, the slider can be used as input for many applications. There isn’t so much to say as this device is made by two potentiometers working together. Indeed, when the cursor slides, it changes the position of two side potentiometers.

Pin description

Slider with pinmap
A photo of our slider showing its header connector with labels.

The slider shown in Fig.1 has six pins:

  1. VCC, (are two connected together) connected to power supply 3.0V DC;
  2. GND, (are two connected together) connection to ground;
  3. OTA, middle pin of potentiometer #1;
  4. OTB, middle pin of potentiometer #2.

We can sample both OTA and OTB making mean to better evaluate slider positioning.

Proposed demo

This demo is just an edit of one proposed in sampling and dimming. Main edit is the on the conversion group as we need to read from two channels instead of one. We connected OTA to PA0 (i.e. ADC1 IN0) and OTB to PA1 (i.e. ADC1 IN1). We sample the sequence OTA, OTB 10 times so we need to provide a buffer of 16-bit unsigned which length is at least 20.

As for sampling and dimming demonstrations we made the mean for sampled values and then we print the result using chprintf().

Project download

The attached demo has been tested under ChibiOS 17.6.x. Note that you can find more recent version of this project int the Download Page. Note also that starting from the version 20 all the demos from PLAY Embedded will be distributed together with ChibiStudio.


Be the first to reply at Reading a Slider

Leave a Reply