How can i make a Matrix small or any idears?

Hello,

can some one help me please i have a problem with the memory, it is to small can i make the matrix in this code smaler ? it is an example now

for ideas i am very happy :wink:

[b] const bool  CirocPic1[512] PROGMEM = {
0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,1,1,1,0,0,1,1,0,1,1,1,1,1,0,0,0,0,1,1,1,0,0,0,0,0,1,1,1,0,0,
0,1,1,0,1,1,0,1,1,0,1,1,0,0,1,1,0,0,1,1,0,1,1,0,0,0,1,1,0,1,1,0,
1,1,0,0,0,1,0,1,1,0,1,1,0,0,0,1,0,1,1,0,0,0,1,1,0,1,1,0,0,0,1,0,
1,1,0,0,0,0,0,1,1,0,1,1,0,0,1,1,0,1,0,0,0,0,0,1,0,1,1,0,0,0,0,0,
1,1,0,0,0,0,0,1,1,0,1,1,1,1,1,0,0,1,0,0,0,0,0,1,0,1,1,0,0,0,0,0,
1,1,0,0,0,1,0,1,1,0,1,1,0,0,1,1,0,1,1,0,0,0,1,1,0,1,1,0,0,0,1,0,
0,1,1,0,1,1,0,1,1,0,1,1,0,0,0,1,0,0,1,1,0,1,1,0,0,0,1,1,0,1,1,0,
0,0,1,1,1,0,0,1,1,0,1,1,0,0,0,1,1,0,0,1,1,1,0,0,0,0,0,1,1,1,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0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,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
 };

void setup() {
 strip.begin();
 strip.show(); // Initialize all pixels to 'off'
 Serial.begin(9600);
}

void loop() {
 delay(1000);
   //  for(uint16_t i=0; i<512; i++) {
   //  strip.setPixelColor(i, strip.Color(0,0,255));
   //  strip.show();
   //  delay(30);
   //  }
 cirocAnimation();
}

void cirocAnimation(){

 Matrix1(CirocPic1);
 Matrix2(CirocPic1);
 delay(10);

 Matrix1(CirocPic2);
 Matrix2(CirocPic2);
 delay(10);

 Matrix1(CirocPic3);
 Matrix2(CirocPic3);
 delay(10);

THANK YOU

you could check for commonalities between the arrays... and let the code copy the right parts..

other idea is to pack the individual 0/1 in single bits, that means 8 values can be stored in a byte or 16 in an int.

can i make the matrix in this code smaler

Yes. Use an array of bytes as you have now but use the bits in each byte for the ones and zeroes. The arrays will take 1/8th of the space.

You can access the value of each bit using bitRead(). See http://arduino.cc/en/Reference/BitRead

Instead of using boolean data type that needs 1 byte per entry, pack the data into bytes. Instead of needing 512 bytes per array you will only need 64 bytes (an 8x reduction). You have not posted the entire code or placed it in a code block so don't know if your even storing data in flash memory.

He's gpot PROGMEM called out, so presumabluy it is storing in flash.

If the OP needs a certain bit, then (s)he can just mask off the bit needed. Or use bitRead() (kinda much for something as simple as bit shifting/masking).

CrossRoads:
He’s gpot PROGMEM called out, so presumabluy it is storing in flash.

Yes but without the rest of the code we don’t know if #include <avr/pgmspace.h> is also included.

Thanks for the answers, it was a good help !!!

Riva:

CrossRoads:
He’s gpot PROGMEM called out, so presumabluy it is storing in flash.

Yes but without the rest of the code we don’t know if #include <avr/pgmspace.h> is also included.

“avr/pgmspace.h” is included in “Arduino.h” which is included in “main.cpp”