Converting an int to an unsigned char for display on a Nokia 5110 I've been working on a small project getting some images displayed in a Nokia 5110 screen via an Arduino. I've been getting it working, but one of the issues I have is that I would like to have a list on integers and convert that an unsigned char array that the display requires. Generally I have something like this which works out of the box.
unsigned char src [] PROGMEM = {0x00, 0x00}

Surprisingly, I found that this also works
unsigned char src [] PROGMEM = {255, 255}

But when I have a list like this
int src [] = {255,255}

and try to convert it to an unsigned char array, things don't display correctly
unsigned char new_src[2];

for (int i=0; i&lt;2; i++){
    new_src[i] = (unsigned char) src[i];
} 

When I try to display this, it's clearly broken. I thought simply casting the int to an unsigned char would be enough (it doesn't work even if I don't cast it).
Here's how I display the array (for 84x48, the above arrays were just an example) :
Adafruit_PCD8544 display = Adafruit_PCD8544(7, 6, 5, 4, 3);
display.drawBitmap(0, 0,  src, 2, 48, BLACK);
display.display();

On more note:
The end game is to have a file with a list of ints. I would then read that list of ints into an array and convert it into an unsigned char array and then display that.
The idea is that I would read a list of ints from a file ( I have
several files that I would iterate through) and convert that list to
the unsigned char array on each loop iteration.

The file could be a stream of bytes just as well as a stream of ints (or uints). If it were, no conversion would need to be done - just read a byte &amp; store it, read a byte &amp; store it, ....  If instead, it is a character representation of values, &quot;37, 150, 8, ...&quot;, again, read the characters of one value, convert them to int8_t or  uint8_t and store them in your byte array. Look up the atoi() or sscanf() functions to do the conversion.