Wiring of potentiometrs and tactile switches.

Hi. I was wanting to wire potentiometers into a curcuit in order to control the color of WS2812 LED’s but dont know how I would wire it. I found this code though.

#include <Adafruit_NeoPixel.h>

#define PIN 9

Adafruit_NeoPixel strip = Adafruit_NeoPixel(60, PIN, NEO_GRB + NEO_KHZ800);

int sensorValue = A0;
int sensorValue2 = A1;
int sensorValue3 = A2;
int currentColourValue;
int currentColourValue2;
int currentColourValue3;

void setup() {
strip.show(); // Initialize all pixels to ‘off’


void loop() {

currentColourValue = (255 - map( analogRead(sensorValue), 0, 1024, 0, 255 ) );
currentColourValue2 = (255 - map( analogRead(sensorValue2), 0, 1024, 0, 255 ) );
currentColourValue3 = (255 - map( analogRead(sensorValue3), 0, 1024, 0, 255 ) );

colorWipe(strip.Color(currentColourValue, currentColourValue2, currentColourValue3), 50); // Red


void colorWipe(uint32_t c, uint8_t wait) {
for(uint16_t i=0; i<strip.numPixels(); i++) {
strip.setPixelColor(i, c);

Second, how do you wire potentiometers with switches like this:

Lastly, how do you wire a 5pin led button like this:


Please read "Read this before posting a programming question" at the top of the forum and post your sketch using code tags.

What happens when you run the code?

Also, post a schematic in CAD or a picture of a hand drawn circuit in jpg or png- (and, please NOT a pretty Fritzing drawing)

What wiring did the author of that code use?

Second, how do you wire potentiometers with switches like this https://www.ttelectronics.com/TTElectronics/media/ProductFiles/Potentiometers/Datasheets/P170.pdf

The wiper S to the analogue input. The other two to 5V and ground. Depending on which one is to ground and which to 5V determines the rotation direction to increase the reading.

Lastly, how do you wire a 5pin led button like this

Com to ground NO - Normally open to the digital input, and enable the internal pull up resistors in the pin mode call in the setup function. The digital input will read low when the switch is pressed.