#include <Adafruit_NeoPixel.h>
 
#define PIN 15
#define numberpixel 16  //使用 neopixel環(共16顆燈)
const int potpin=34 ;  // GPIO34接可變電阻
int potValue=0;        //設定讀取類比訊號(可變電阻)初始值=0

 
// When we setup the NeoPixel library, we tell it how many pixels, and which pin to use to send signals.
// Note that for older NeoPixel strips you might need to change the third parameter--see the strandtest
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(numberpixel, PIN, NEO_GRB + NEO_KHZ800);
 
void setup()
{
pixels.begin(); // This initializes the NeoPixel 
pixels.setBrightness(255); // 設定亮度
}
 
void loop()
{
  int val1;
  potValue=analogRead(potpin);   //讀取類比值(介於0~4095)
  val1=map(potValue,0,4095,0,255);  //使用map函數,將0~4095對應為0~255
  for(int i=0; i<numberpixel; i++)  //依序點亮16顆燈
  {
    //pixels.clear();  //清除目前ws2812燈的顏色狀態
    pixels.setPixelColor(i, pixels.Color(val1,255-val1,128-val1));  //設定目前ws2812的顏色
    pixels.show();  //顯示
    delay(100);   //延遲0.1秒
  }

}
esp:VIN
esp:GND.2
esp:D13
esp:D12
esp:D14
esp:D27
esp:D26
esp:D25
esp:D33
esp:D32
esp:D35
esp:D34
esp:VN
esp:VP
esp:EN
esp:3V3
esp:GND.1
esp:D15
esp:D2
esp:D4
esp:RX2
esp:TX2
esp:D5
esp:D18
esp:D19
esp:D21
esp:RX0
esp:TX0
esp:D22
esp:D23
$abcdeabcde151015202530fghijfghij
pot1:GND
pot1:SIG
pot1:VCC
ring1:GND
ring1:VCC
ring1:DIN
ring1:DOUT