Using single Potentiometer to control color of NeoPixel

Hi, im quite new to coding and really only use it for small projects. i have a project where i want to use a potentiometer to control the color of my NeoPixel strip. I have followed the instructions of a man by the name of Anthony Baltazar on youtube where he makes a very similar device. It works well, it changes the color of the LEDS perfectly. However, i want all my LEDS to be the same solid color rather than one moving LED. Does anyone know how i could alter the code to fit my purpose.
Here is the code:

#include <Adafruit_NeoPixel.h>
#define LED_COUNT 60
#define LED_PIN 9
Adafruit_NeoPixel strip = Adafruit_NeoPixel (LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);

void setup() {
  strip.begin();
  strip.show();
}

int pix;

void loop() {
  int pot = analogRead (6);
  pix++;
  pix%=LED_COUNT;
  setPixel(pix,pot,255);
  strip.show();
 for(int a=0;a<LED_COUNT;a++){
    strip.setPixelColor(a,0,0,0);
  }
  delay(150);

}

void setPixel(int pixelz, int colorz, long unsigned fadez) {
  fadez*=fadez;
  fadez/=255;
  strip.setPixelColor(pixelz,strip.ColorHSV(colorz*64,255,fadez));
}

Try

void loop() {
  int pot = analogRead (6);
  for(int a=0;a<LED_COUNT;a++){
   setPixel(a,pot,255);
}
  strip.show();

}

Thank you, this worked flawlessly.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.