#include <FastLED.h>    //声明FastLED库 Declare the FastLED library

#define LED_PIN 7       //定义WS2812 RGB灯引脚 Define the WS2812 RGB lamp pin
#define NUM_LEDS 12     //定义灯珠数量 Define the number of beads
#define BRIGHTNESS 64   //设定灯光亮度，范围0~255,数字越大越亮 Set the light level from 0 to 255, with the higher the light
CRGB leds[NUM_LEDS];    //实例化一个长度为 NUM_LEDS 的 CRGB 类型数组，用于控制WS2812B LED灯条 An array of CRGB type with length NUM_LEDS is instantiated to control the WS2812B LED strip
void setup() {
  FastLED.addLeds<NEOPIXEL, LED_PIN>(leds, NUM_LEDS);  //使用NEOPIXEL类型 Use the NEOPIXEL type
  FastLED.setBrightness(BRIGHTNESS);                   //初始化灯光亮度 Initialize the light level
}

void loop() {
  //逐个点亮LED显示绿色 Light the leds one by one to show green
  for (int i = 0; i < NUM_LEDS; i++) {
    fill_solid(leds, NUM_LEDS, CRGB::Black);  //将所有LED关闭 Turn off all leds
    leds[i] = CRGB::Green;                    //仅点亮当前LED Light only the current LED
    FastLED.show();
    delay(100);
  }
}
