我想使用neoPixel和atm 8 led燈帶(會更長時間後)閃爍顏色。我想要做的是給出一個像素信息的列表,並通過列表循環,並按照「腳本數組」的說法閃爍燈光。Arduino Uno陣列失敗
這是到目前爲止,我已經做了代碼:
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h>
#endif
#define PIN 6
Adafruit_NeoPixel strip = Adafruit_NeoPixel(8, PIN, NEO_GRB + NEO_KHZ800);
void setup() {
strip.begin();
strip.show();
int array[2][8][3] = {
{{120, 100, 40},{120, 100, 40},{120, 100, 40},{120, 100, 40},{120, 100, 40},{120, 100, 40},{120, 100, 40},{120, 100, 40}},
{{50, 90, 200}, {50, 90, 200},{50, 90, 200},{50, 90, 200},{50, 90, 200},{50, 90, 200},{50, 90, 200},{50, 90, 200}}
}; // flashing two colors on all leds
}
void loop() {
fromArray(50);
}
void fromArray(uint8_t wait){
for(int i=0; i<2; i++){
for (int j=0; j<8; j++){
strip.setPixelColor(j, strip.Color(array[i][j][0],array[i][j][1],array[i][j][2]))
}
strip.show();
delay(wait)
}
}
當我檢查這個代碼,我從線strip.setPixelColor(j, strip.Color(array[i][j][0],array[i][j][1],array[i][j][2]))
得到錯誤'array' was not declared in this scope
。
謝謝你的快速回答,你們倆。不知何故,那裏滑倒了,好吧。時間繼續與相框:) – Duzzz