我有一个arduino使用fastLED与600 ws2812b灯条。我正在运行下面的代码:意想不到的变化行为arduino fastLED ws2812b
#include "FastLED.h"
#define DATA_PIN 5 // change to your data pin
#define COLOR_ORDER GRB // if colors are mismatched; change this
#define NUM_LEDS 600 // change to the number of LEDs in your strip
#define BRIGHTNESS 32
#define WRAP_NUM 55
#define LED_TYPE WS2812B
CRGB leds[NUM_LEDS];
int startIndex=0;
int bottom=1;
void setup()
{
delay(3000);
FastLED.addLeds<LED_TYPE, DATA_PIN, COLOR_ORDER>(leds, NUM_LEDS);
FastLED.setBrightness(BRIGHTNESS);
}
void loop()
{
shapeTwirl();
}
void shapeTwirl()
{
FastLED.clear();
static int heart[]={bottom*WRAP_NUM};
for(int i=0;i<sizeof(heart);i++)
{
leds[(heart[i]+startIndex)]=CRGB::Red;
}
FastLED.show();
delay(70);
startIndex=(startIndex+1)%WRAP_NUM;
}
我有我的灯在一个圆圈,这使得围绕圆圈红点。然而,一个大约100盏灯的蓝点也在旋转。我的代码中没有任何东西可以制造蓝光。我已经跟踪到使用
int bottom=1;
如果我用代码中的数字替换底部,我摆脱了蓝点,它正常工作。如果我#define底部1;问题也解决了。如果我现在或在shapeTwirl中定义底部,则无关紧要。这导致我相信有一个错误的底部使用变量,但我已经尝试使用int,static int,unsigned int无济于事。
为什么指示灯不亮?
我使用一个Arduino UNO来控制灯光和外部电源为其供电。