Reply to thread

Well, I just ended up using Adafruit's NeoPixel library. It works fine! Feel free to use my AtmoDuino code! I think it's just some bug in FastLED or something.


[code]

#include <Adafruit_NeoPixel.h>


#define NUM_LEDS  64

#define DATA_PIN  3

#define COLOR_ORDER NEO_GRB

#define STRIP_RATE  NEO_KHZ800


Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUM_LEDS, DATA_PIN, COLOR_ORDER + STRIP_RATE);


void setup(){

  Serial.begin(115200);


  strip.begin();

  strip.show(); // Initialize all pixels to 'off'

  loopLeds;

  strip.clear();

  strip.show();

}


int readByte(){

  while (Serial.available() == 0){ /* wait for data */ }

  return Serial.read();

}


void loopLeds(){

for(int j = 0; j < 3; j++) {

  for(int i = 0 ; i < NUM_LEDS; i++ ) {

  switch(j) {

  case 0: strip.setPixelColor(i, strip.Color(255, 0, 0)); break;

  case 1: strip.setPixelColor(i, strip.Color(0, 255, 0)); break;

  case 2: strip.setPixelColor(i, strip.Color(0, 0, 255)); break;

  }

  strip.show();

  delay(5);

  }

  }

}



void loop() {

  if(readByte() == 0xFF){

  if(readByte() == 0x00){

  if(readByte() == 0x00){

 

  int channels = readByte();

 

  for(int dot = 0; dot < channels; dot++){

  int r = readByte();

  int g = readByte();

  int b = readByte();

 

  strip.setPixelColor(dot, strip.Color(r, g, b));

  }

 

  strip.show();

  }

  }

  }

}

[/code]


Top Bottom