Animations on an OLED

Yes, I have been thinking about using a Due. But since this project is intended to be a contribution to another DYI fellowship, I want to keep it as simple and cheap as possible, and the stirrer mechanism itself doesn't really need all that much bling. So if necessary, I'll probably just tone down my ambitions in terms of presentation and panache. Otherwise, I'd just go for a Raspberry Pi and make use of the full video capabilities of that solution.

Try U8x8lib.h
See this video starting at 1:55...

1 Like

Hello friends,

I'm a new kid on the block here, so please be patient with me.

I made a few frames on Piskel exported as a C array.
I imported the array to a wokwi project, see this link: DisplayDemo - Wokwi ESP32, STM32, Arduino Simulator

But somehow it doesn't work and I'm not able to debug now. I tried animation generated with animator.wokwi.com and imported to my same project and that works.

So the generated C array seems not to be working with display.drawBitmap().

I hope you guys can help me. :grinning:

There should not be 1024 bytes of data in a 32x32 bit image, that is only 128 bytes of data.

1 Like

Ok, so each byte is actually 1 bit?
Do you have a tip or a code snippet to solve this?

Thank you :pray:t3:

I won’t have time to look at the code until tonight.

1 Like

Hello guys,

I came with the following snippet of code to convert Piskel generated C array to Arduino display type of array:

printf("{\n");

// Our frames with 1024 integers generated by Piskel
const uint32_t images[][1024];

int size = 0;

  // begin of array[][], assuming number_of_frames = 10
  for(int p=0; p<number_of_frames; p++) { 
      
    printf("{\n");
    
    uint8_t pixel = 0;
	
	// get a frame
    uint32_t *image = images[p];
    
    // we grab each time a row within a frame,
    for (int v = 0; v < 32; v++) {
		
		// here we get 32 elements/integers
        uint32_t *row = image+(v*32);
        
		// each element (=integer) corresponds to 1 bit for tft display	
		
        // loop through 32 elements in steps of 8, making them bits
        for(int m=0; m<32; m += 8) {
            
            pixel = 0;
				
			for (int i = 0; i < 8; i++) { // loop through 8 elements
				uint32_t word = row[m*8 + i]; // get 1 element
				
				// move word msb to lsb and move that to msb of byte
				// OR it with the next bit
				pixel |= (uint8_t)(word >> 31) << (8-1-i);
			}
			
			// our frames array to render later
			frames[p][m] = pixel;
			
			if(m >= 31)
				printf("0x%02X\n", (uint8_t)pixel);
			else
				printf("0x%02X,", (uint8_t)pixel);
			}
        }
    }
    
    printf("\n},\n");
  }

printf("}");

Than I copy the output and paste it in Arduino's sketch. But it is not good yet, it shows the image wrong, but at least it shows something. Maybe someone can find the problem in the code?

Thank you!

Hi, I too faced this problem with WokWi. Later I found that it was not working on Safari browser. It was working fine on Chrome.
Hope that helps someone wondering why :slight_smile:

@meberty
@aldev

Do not hijack posts.