Post topics, source code that relate to the Arduino Platform

User avatar
By 3DtronX
#60087 This is my first post because I usually don't run into problems I cant find solutions for on this forum, so thanks for that community! :D


I'm trying to display images (monochrome bit map already converted to a unsigned_char_Array[]) on a 2 inch e paper using this image library function: "void ShowBitMap(unsigned_char_Array)". I have successfully tested it on the epaper by saving the image arrays in the sketch, but I end up running out of RAM (I think) because the ESP8266 crashes after I get up to 5 image Arrays saved. To solve this I have started playing with SPIFF as a way to save the image arrays so that I can have more than 4 images to choose from without crashing the code. I have successfully Serial.print the stored "image arrays" from SPIFF to confirm they are there the way I want them. Although the data was there, it comes out as a string and the function "void ShowBitMap(unsigned_char_Array)" doesn't accept strings, so I use "unsigned char* valChar = (unsigned char*) data.c_str()" to convert the strings from SPIFF into unsigned char arrays. I then input the newly converted unsigned char Arrays into the image library function with no compile errors. Sadly, the image doesn't ever render correctly when I upload the code.

below is what the image looks like as an array stored on the sketch when it works. The SPIFF string produces the exact same thing which I confirmed through serial.print, except I removed the header and braces. I also tried leaving the braces in to see if that would fix the problem, but again with no luck .

Has anyone done something similar? I am essentially trying to recreate exactly what you see below: unsigned char NOA_Logo[1548], from a string that is pulled from SPIFF.

function & array that work:

ShowBitMap(NOA_Logo);


unsigned char NOA_Logo[1548] = {
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x9F, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x8F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x07, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x07, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0x07, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x07, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
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, 0xFF, 0xFF, 0xFF, 0x07, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x8F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
}
User avatar
By 3DtronX
#60123 I will ask the same question with less context. how do I convert a string into an unsigned_char_array. The array needs to be an exact replica of the string. Since posting the original question, I have managed to print out the array and confirmed its containing junk.
User avatar
By RichardS
#60125 I think its:

Code: Select allString s;
char *p;

p = s.c_str();


Might have to cast for const or unsigned....

RichardS