mortonkopf
Well-known member
Hi all, thanks to ZTiK.nl for pointers to using SD card buffers, I have now finished the Pixel Poi POV that reads BMP from the SD card and displays on 60 WS2811 leds (from a 144led/m strip). I have posted the full code over on a blog, as its a bit long to put up here.
here are some photos of images being displayed on the POV. Each image is 60 x 150 pixels, and is read in about 300ms. The code repeats the display of the images for a given number of secs then moves on to the next image file named in the loop. If anyone can see how performance can be improved, please let me know.
Oh, and thanks to everyone on this forum for your help.
The code uses the buffer set up that ZTiK.nl highlighted for the tft screen output:
The Color() function is a helper function that puts the separate colour bits together in the right way.
The full code is at: http://orchardelica.com/wp/displaying-led-graphic-poi-bmp-from-sd-card
here are some photos of images being displayed on the POV. Each image is 60 x 150 pixels, and is read in about 300ms. The code repeats the display of the images for a given number of secs then moves on to the next image file named in the loop. If anyone can see how performance can be improved, please let me know.
Oh, and thanks to everyone on this forum for your help.
The code uses the buffer set up that ZTiK.nl highlighted for the tft screen output:
Code:
for (row=0; row<h; row++) {
if(flip) // Bitmap is stored bottom-to-top order (normal BMP)
pos = bmpImageoffset + (bmpHeight - 1 - row) * rowSize;
else // Bitmap is stored top-to-bottom
pos = bmpImageoffset + row * rowSize;
if(bmpFile.curPosition() != pos) { // Need seek?
bmpFile.seekSet(pos);
buffidx = sizeof(sdbuffer); // Force buffer reload
}
for (col=0; col<w; col++) { // For each column...
// read more pixel data
if (buffidx >= sizeof(sdbuffer)) {
povidx = 0;
bmpFile.read(sdbuffer, sizeof(sdbuffer));
buffidx = 0; // Set index to beginning
}
// set pixel
b = sdbuffer[buffidx++];
g = sdbuffer[buffidx++];
r = sdbuffer[buffidx++];
povbuffer[povidx++] = Color(b,r,g);//octo colour, but you might need to change this
}
for(int i=0;i<ledsPerStrip;i++){
leds.setPixel(i, povbuffer[i]); }
leds.show();
// delay(1);// change the delay time depending effect required
delayMicroseconds(220);
} // end scanline
The Color() function is a helper function that puts the separate colour bits together in the right way.
The full code is at: http://orchardelica.com/wp/displaying-led-graphic-poi-bmp-from-sd-card
Last edited: