String abc ="0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff";
const unsigned char displaydata={reinterpret_cast<const unsigned char*>(abc.c_str())};
display.drawBitmap(displaydata, startX, startY, bmpWidth, bmpHeight, GxEPD_WHITE);
Get error: invalid conversion from 'const unsigned char' to 'unsigned char' [-fpermissive]*
When I write like this
String abc ="0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff";
display.drawBitmap(reinterpret_cast<const unsigned char*>(abc.c_str()), startX, startY, bmpWidth, bmpHeight, GxEPD_WHITE);
No error but black screen no display image
When I write like this
const unsigned char displaydata[]={ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
display.drawBitmap(displaydata, startX, startY, bmpWidth, bmpHeight, GxEPD_WHITE);
It is working
The string data coming from the server is returning to me as stirng, I am trying to reflect it on the screen. I want to convert a string data to const unsigned char with code
So I'm trying to convert
const unsigned char displaydata={reinterpret_cast<const unsigned char*>(...
you're assigning a pointer to a single character. Or more importantly, part of a pointer to a character, which if the memory address (pointer value) was larger than 0xFF would be pretty useless. So, the problems start here with a missing pointer declarator (a*
) There's not much Arduino to the question. Fairly squarely a C++ question, unless I'm missing something.String
is a custom Arduino class, so could be classed as an arduino question (pun intended) on that merit.const
, that's irrelevant.