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.
The slider shown in Fig.1 has six pins:
- VCC, (are two connected together) connected to power supply 3.0V DC;
- GND, (are two connected together) connection to ground;
- OTA, middle pin of potentiometer #1;
- OTB, middle pin of potentiometer #2.
We can sample both OTA and OTB making mean to better evaluate slider positioning.
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().
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.