I have LED strip of 300 pixels, and I'm sending data (only commands, not pixel-by-pixel) through the serial to an Uno, however when I try to use more pixels (requiring more memory), I get inaccuracies in the serial communication. If I lower the number of LEDs, I get more and more stable communication. So it is perfectly stable when the compiler says "leaving 1634 bytes for local variables" (20 LEDs), but when using 80 LEDs the free memory is at 1454 (so 70% of all memory) it gets unstable, meaning that the commands mostly get through, however most of the time with wrong arguments, and sometimes it gets it right. Higher LED counts lower the accuracy.
Could probably also think about hardware --- or hardware requirements.... maybe. Like, how are you powering your LEDs? Is the power supply adequate?
And....for testing purposes only.... what happens if you put a line like 'delay(1000)' in your loop? For testing only.
Also....what do you mean by 'lowers the accuracy'? Eg..... the accuracy of what? Do you mean.... you type in a command, and the arduino doesn't receive the command strings accurately? So, even when the LED strips are not connected, the serially-transmitted commands from computer to arduino are received (by the arduino) with errors? And these erroneous strings etc are seen (observed) in Serial Monitor?
thanks, there was a delay in the main loop, however it was the fastled delay, which keeps refreshing the leds "while paused". I changed that to a regular delay, and it works fine now. Thanks for your tips.
By accuracy I meant that I had higher success ratio of sending commands successfully. I changed the "unrecognised" command to echo back the command it received, and there were missing characters randomly.
about the power supply: I'm using this one:
however it shifts towards red towards the end of the strip (and also vibrates constantly a bit). I can just plug in power at the other end, it would work fine, right?
AWOL:
Could be you're sending commands too frequently, and screwing the timing for the LED command stream
I guess this is the case indeed. Now it is working almost fine, however, when sending too much in short time (I should solve this in Processing also), Arduino receives incorrect data.
Could you help me understand how the timing works here? I thought that the following code will first read the data from serial (which calls a function which changes the leds variable), then send to the leds with the show() function. But even if multiple commands are in the serial buffer, first it should use that data, and only after the buffer is empty, it can move on to the next line of code and start sending data to the leds. Or are these happening in parallel? Also one is going on pin 6, the other is on serial, I would think they are independent, but can these two interfere with each other?