512 LEDs will need to allocate 1536 bytes of ram for buffers at runtime. Your code only has 1485 bytes available.