Issue sending a bitmap to Digole screens?

Hello again :smile:

Hopefully this one is a quicker fix than some of my other issues were. I have a few 1.3’’ 128x64 Digole displays connected to my Spark, and I would like to send bitmap images to them. Searching through the ginormous Digole thread, I determined that I would need to first convert a black-and-white image to bitmap via this link: http://www.digole.com/tools/PicturetoC_Hex_converter.php, and then call drawBitmap() on my display object.

So in the setup function, right after I clearScreen(), I wrote:

const unsigned char bitmapData[] = { 0x00,0x00,0xff, ... etc };
myDisplay.drawBitmap256(0, 0, 128, 64, bitmapData);

However, when I try flashing the code my spark goes into a vicious loop of flashing green, solid cyan, flashing cyan, flashing red, flashing cyan again, flashing green again, etc. It never ends, the displays that are connected to the Spark turn off, and if I want to modify anything I need to factory reset the Spark and start all over.

I did successfully get something to work by calling “drawBitmap” instead of “drawBitmap256”, but it still took forever and the image came out garbled. Surely there’s a tried-and-true way to put images on these displays?

Thanks a lot for the help in advance.

Another thing - for some reason, the online converter is giving me some hexadecimal values that are in-between 0x00 and 0xff, even though the .png I uploaded only has black and white pixels. Is this something to be concerned with? I tried manually changing all of the intermediate values to either 0x00 or 0xff and copying that into the bitmapData array, but even after I called “drawBitmap” (not “drawBitmap256”) the output was still garbled. I’ve attached an image of what the final output looks like (the original bitmap was supposed to be an image of the word “WHITE” in bold text).

@Pete, by declaring:

const unsigned char bitmapData[] = { 0x00,0x00,0xff, ... etc };

in your setup(), it becomes a local variable and gets allocated in RAM which is not the way to go. Instead, put the declaration at the top of the file, before setup() so it is allocated in flash instead.

As for the converter, each pixel on the screen is represented by a bit in a byte of data. As such, each byte actually represents 8 pixels. When you did your conversion, did you make sure to select “used for” as “Black/White for all draw image function”?

You cannot call drawBitmap256 with a monochrome display, only drawBitmap. The former is for color OLED displays.

Try the things above and make sure your conversion is correct and let me know how it goes. :slight_smile:

3 Likes

All of those things did the trick! Wonderful, thank you peekay :slight_smile: And thanks for the explanation about variables loaded into RAM vs flash memory, that’ll be valuable information for the future.

1 Like