LEDControl/LED_Panel_arduino_fastled/LED_Panel_arduino_fastled.ino

47 lines
663 B
Arduino
Raw Normal View History

2021-03-14 12:18:00 +01:00
#include <FastLED.h>
#define PIN 3
#define LED_COUNT 512
#define BAUD 1000000
CRGB leds[LED_COUNT];
void setup() {
FastLED.addLeds<NEOPIXEL, PIN>(leds, LED_COUNT);
Serial.begin(BAUD);
Serial.setTimeout(500);
}
// main program
void loop() {
byte buf[1];
unsigned int c=0;
while(Serial.read() != 255){
if(c > 100000){
for (uint16_t i = 0; i < LED_COUNT; i++){
leds[i] = CRGB(0,0,0);
}
FastLED.show();
}
c++;
}
if(c>1){
}
for (uint16_t i = 0; i < LED_COUNT; i++)
{
char col[3];
Serial.readBytes(col, 3);
leds[i] = CRGB(col[0], col[1], col[2]);
}
FastLED.show();
}