How many Leds can control

Hi.

I want to build a led wal with ws2812b leds controlled by an arduino Mega

with this code

#include <Adafruit_NeoPixel.h>

#define PIN            11 
#define NUMPIXELS      32
 
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);

int v1 = 0;
int v2 = 0;  
int v3 = 0;
int v4 = 0;  

void setup() {

 

   Serial.begin(9600);
   pixels.begin(); 

}


void loop(void) {


  if (Serial.available() > 3) {

      v1 = Serial.read();
      v2 = Serial.read();
      v3 = Serial.read();
      v4 = Serial.read();    


       pixels.setPixelColor(v1, pixels.Color(v2,v3,v4)); 
       pixels.show(); 


}
}

Is there a limit on how many can be controled ?

Thanks

Yes.
The amount of RAM you have.

Memory

An Arduino Uno has 2kb of memory. One Neopixel led uses 3 bytes of memory. That means you can drive about 600 Neopixels, or a bit less, depending on the size of the rest of your program.

Ref:Powering lots of LEDS from Arduino – Erik Katerborg

RV mineirin

With the posted code, you can control 32 pixels.

It's a little more convoluted but you can control a lot more than you have RAM for if you are using a repeating pattern or a very simple/predicable pattern

What kind of pattern do you want to use?

Thank for the answers.

I know that code is for 32

I will use arduino mega2560 so x4 ram than uno
Thats 2400. Right?

I will control it with serial data coming from PC. Any pattern Possible