Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#include <Adafruit_NeoPixel.h>
Adafruit_NeoPixel strips[8] = {
Adafruit_NeoPixel(72, 1, NEO_GRB + NEO_KHZ800),
Adafruit_NeoPixel(72, 2, NEO_GRB + NEO_KHZ800),
Adafruit_NeoPixel(72, 3, NEO_GRB + NEO_KHZ800),
Adafruit_NeoPixel(72, 4, NEO_GRB + NEO_KHZ800),
Adafruit_NeoPixel(72, 5, NEO_GRB + NEO_KHZ800),
Adafruit_NeoPixel(72, 6, NEO_GRB + NEO_KHZ800),
Adafruit_NeoPixel(72, 7, NEO_GRB + NEO_KHZ800),
Adafruit_NeoPixel(72, 8, NEO_GRB + NEO_KHZ800)
};
byte lastformat[72];
boolean gettingPattern = false;
byte patternCount = 0;
byte patternLength = 16;
void setup() {
memset(lastformat, 0, sizeof(lastformat));
Serial.begin(115200);
for(byte i = 0; i < 8; i++) {
strips[i].begin();
strips[i].show();
}
}
void loop() {
readData();
writeOut();
}
void readData() {
if(Serial.available()) {
byte data = Serial.read();
if(data == 0xff)
gettingPattern = true;
else if(gettingPattern) {
int position = patternCount * 2;
lastformat[position] = data & 0xf;
lastformat[position+1] = (data & 0xf0) >> 4;
patternCount++;
if(patternCount == patternLength) {
gettingPattern = false;
}
}
}
}
void writeOut() {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.