#include <FastLED.h>
// 虚拟WS2812B灯带的配置
#define NUM_LEDS 1 // LED数量
#define DATA_PIN 13 // 虚拟数据引脚编号
// 定义LED数组
CRGB leds[NUM_LEDS];
void setup() {
Serial.begin(115200);
Serial.println("疗愈灯光系统启动 (WS2812B仿真模式)...");
// 初始化FastLED库
FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS);
FastLED.setBrightness(80); // 设置亮度 (0-255)
// 初始化为熄灭
FastLED.clear();
FastLED.show();
delay(500);
Serial.println("仿真灯带就绪,开始色彩循环。");
}
void loop() {
// 场景1: 疗愈紫色
Serial.println("=== 场景: 深度放松 (紫色) ===");
leds[0] = CRGB(180, 0, 180);
FastLED.show();
delay(3000);
// 场景2: 温暖黄色
Serial.println("=== 场景: 温馨安抚 (暖黄色) ===");
leds[0] = CRGB(255, 100, 30);
FastLED.show();
delay(3000);
// 场景3: 宁静蓝色
Serial.println("=== 场景: 专注平静 (蓝色) ===");
leds[0] = CRGB(30, 100, 255);
FastLED.show();
delay(3000);
}