#include <Adafruit_NeoPixel.h>

#define PIN            6 
#define NUMPIXELS      48 
int delayTime=50;
int colorC=50;
const int potentiometerPin=A0;
const int color=A1;
Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
void setup() {
  pixels.begin();
  pixels.show(); // 初始化NeoPixel
  pinMode(potentiometerPin, INPUT);
  pinMode(color, INPUT);
}

void loop() {
  int potValue = analogRead(potentiometerPin); 
  int ntr = analogRead(color);
  delayTime = map(potValue, 0, 1023, 1, 1000);
  colorC = map(ntr, 0, 1023, 100, 255);
  static int i=0 ;
  pixels.setPixelColor(i,pixels.Color(random(colorC),random(colorC),random(colorC)));
  pixels.show();
  delay(delayTime/3);
  i=(i+1)%48;
}