|
楼主 |
发表于 2020-3-1 10:11:08
|
显示全部楼层
程序之三:四色交替流水灯
- /*
- 【Arduino】168种传感器模块系列实验(资料+代码+图形+仿真)
- 实验一百四十六:64位 WS2812B8*8 xRGB 5050 LED模块 ws2812s像素点阵屏
- 安装FastLED库,工具—管理库—搜索FastLED—安装
- 程序之三:四色交替流水灯
- 实验接线
- Module UNO
- VCC —— 3.3V
- GND —— GND
- DI —— D6
- */
- #include <FastLED.h>
- #define LED_PIN 6
- #define NUM_LEDS 64
- CRGB leds[NUM_LEDS];
- void setup() {
- FastLED.addLeds<WS2812, LED_PIN, GRB>(leds, NUM_LEDS);
- }
- void loop() {
- for (int i = 0; i <= 63; i++) {
- leds[i] = CRGB ( 0, 0, 200);
- FastLED.show();
- delay(33);
- }
- for (int i = 63; i >= 0; i--) {
- leds[i] = CRGB ( 89, 0, 0);
- FastLED.show();
- delay(33);
- }
- for (int i = 0; i <= 63; i++) {
- leds[i] = CRGB ( 0, 89, 0);
- FastLED.show();
- delay(33);
- }
- for (int i = 63; i >= 0; i--) {
- leds[i] = CRGB ( 89, 0, 200);
- FastLED.show();
- delay(33);
- }
- }
复制代码 |
|