converting from unsigned char into static const unsigned char

Hi guys,

My variable that is received from the serial port has the following form:

0x21, 0x00, 0x00, 0x00, 0x00, 0x49, 0x51, 0x10, 0x68, 0x80, 0x00, 0x40, 0x00, 0x22, 0x00, 0x00,
0x00, 0x00, 0x64, 0x41, 0x10, 0x10, 0x42, 0x01, 0x08, 0x00…

and I need to covert it into static const unsigned char

with the following form

static const unsigned char {

0x21, 0x00, 0x00, 0x00, 0x00, 0x49, 0x51, 0x10, 0x68, 0x80, 0x00, 0x40, 0x00, 0x22, 0x00, 0x00,
0x00, 0x00, 0x64, 0x41, 0x10, 0x10, 0x42, 0x01, 0x08, 0x00…
};

Why do you need to do that?

Thanks for replying.

I am reading a text file from SD card and I need to show it as an image on an OLED In The SeeedGrayOled.drawBitmap function the variable should be static const unsigned char

Easier to change the drawBitmap function parameter definition instead.

My variable that is received from the serial port has the following form:

The variable is received and stored in [u]binary form[/u].

You are showing the human-readable hexadecimal notation for those binary values.

You need "const" only for really constant values, not for values which are changed later, e.g. from input. Remove it, and it should compile.

jremington:
Easier to change the drawBitmap function parameter definition instead.
The variable is received and stored in binary form.

You are showing the human-readable hexadecimal notation for those binary values.

jremington:
Easier to change the drawBitmap function parameter definition instead.

Any more explanation?

I am reading the image from the SD card after changing it into a hex form and putting the result in SD card in text file then reading from the SD card.

The default example that was given with the library of the OLED uses this function to show an image or a logo.

I don’t think it is easy to change the function.

Thanks again.

I don't think it is easy to change the function.

I do. See reply #4.

The compiler takes constants as constants.

You cannot change values of constants after compilation time.

May be global variables are a solution for you. I did not do any deep thinking about this proposal. It is Saturday evening and the sports events are showing up.

arduinoaleman: The compiler takes constants as constants.

You cannot change values of constants after compilation time.

May be global variables are a solution for you. I did not do any deep thinking about this proposal. It is Saturday evening and the sports events are showing up.

Thanks a lot Let us keep it for Monday

Hi, I am looking for your help. Best regards

What are you looking for help with?