采用arduino主控,这是第一代产品,后续会改进一下。
这个是配套的arduino程序
#include <FastLED.h>
#define LED_PIN 3
#define NUM_LEDS 14
CRGB leds[NUM_LEDS];
void setup() {
FastLED.addLeds<WS2812, LED_PIN, GRB>(leds, NUM_LEDS);
leds[0] = CRGB ( 111, 111, 111);
FastLED.show();
delay(1000);
leds[2] = CRGB ( 111, 111, 111);
FastLED.show();
delay(1000);
leds[4] = CRGB ( 111, 111, 111);
FastLED.show();
delay(1000);
leds[6] = CRGB ( 111, 111, 111);
FastLED.show();
delay(1000);
leds[8] = CRGB ( 111, 111, 111);
FastLED.show();
delay(1000);
leds[10] = CRGB ( 111, 111, 111);
FastLED.show();
delay(1000);
}
void loop() {
for(int a = 0; a <= 13; a++)
{
for (int i = 0; i <= 13; i++) {
leds[i] = CRGB ( 0, 0, 0);
FastLED.show();
}
leds[a] = CRGB ( 0, 0, 255);
FastLED.show();
delay(100);
}
for(int a = 0; a <= 13; a++)
{
for (int i = 0; i <= 13; i++) {
leds[i] = CRGB ( 0, 0, 0);
FastLED.show();
}
leds[a] = CRGB ( 0, 255, 0);
FastLED.show();
delay(100);
}
for(int a = 0; a <= 13; a++)
{
for (int i = 0; i <= 13; i++) {
leds[i] = CRGB ( 0, 0, 0);
FastLED.show();
}
leds[a] = CRGB ( 255, 0, 0);
FastLED.show();
delay(100);
}
for (int i = 0; i <= 13; i++) {
leds[i] = CRGB ( 255, 0, 0);
FastLED.show();
delay(110);
}
for (int i = 0; i <= 13; i++) {
leds[i] = CRGB ( 0, 255, 0);
FastLED.show();
delay(110);
}
for (int i = 0; i <= 13; i++) {
leds[i] = CRGB ( 0, 0, 255);
FastLED.show();
delay(110);
}
for(int b = 170; b < 255; b++)
{
for (int i = 0; i <= 13; i++)
{
leds[i] = CRGB ( b, b, 0);
FastLED.show();
delay(10);
}
for (int i = 0; i <= 13; i++)
{
leds[i] = CRGB ( b, 0, b);
FastLED.show();
delay(10);
}
for (int i = 0; i <= 13; i++)
{
leds[i] = CRGB ( 0, b, b);
FastLED.show();
delay(10);
}
}
for (int k = 0; k <= 5; k++)
{
for (int i = 0; i <= 13; i++) {
leds[i] = CRGB ( 255, 0, 0);
FastLED.show();
delay(30);
}
for (int i = 0; i <= 13; i++) {
leds[i] = CRGB ( 0, 255, 0);
FastLED.show();
delay(30);
}
for (int i = 0; i <= 13; i++) {
leds[i] = CRGB ( 0, 0, 255);
FastLED.show();
delay(30);
}
}
}
!注意:请使用浏览器自带下载,迅雷等下载软件可能无法下载到有效资源。
欢迎加入EEWorld参考设计群,也许能碰到搞同一个设计的小伙伴,群聊设计经验和难点。 入群方式:微信搜索“helloeeworld”或者扫描二维码,备注:参考设计,即可被拉入群。 另外,如您在下载此设计遇到问题,也可以微信添加“helloeeworld”及时沟通。
EEWorld Datasheet 技术支持