|
|

楼主 |
发表于 2019-9-4 13:06:30
|
显示全部楼层
- /*
- 【Arduino】108种传感器模块系列实验(资料+代码+图形+仿真)
- 实验一百零五:12位 WS2812 5050 RGB LED 智能全彩RGB环开发板大环
- 1、安装库:IDE-工具-管理库-搜索Adafruit_NeoPixel-安装
- 2、项目:逐个点亮不同序列的LED(可设置为任何颜色)
- 3、接脚:
- VCC → 5V
- GND → GND
- DI 接 D7
- */
- #include <FastLED.h>
- #define LED_PIN 7
- #define NUM_LEDS 12
-
- CRGB leds[NUM_LEDS];
-
- void setup() {
- FastLED.addLeds<WS2812, LED_PIN, GRB>(leds, NUM_LEDS);
- }
- void loop() {
-
- leds[0] = CRGB(255, 0, 0);
- FastLED.show();
- delay(500);
- leds[1] = CRGB(0, 255, 0);
- FastLED.show();
- delay(500);
- leds[2] = CRGB(0, 0, 255);
- FastLED.show();
- delay(500);
- leds[5] = CRGB(150, 0, 255);
- FastLED.show();
- delay(500);
- leds[9] = CRGB(255, 200, 20);
- FastLED.show();
- delay(500);
- leds[3] = CRGB(85, 60, 180);
- FastLED.show();
- delay(500);
- leds[7] = CRGB(50, 255, 20);
- FastLED.show();
- delay(500);
- }
复制代码 |
|