Printing variable custom characters

Hi,

i’m trying to print a 5x8 custom character on orangutan, that is always changing according to some other variables (like a bar plot). The problem is that the lcd_load_custom_character function loads the information from the program space, which is ROM and can only be written once, on variable’s inicialization (with the PROGMEM macro).

Is there any work around this so i can print variable custom pixels on pololu’s LCD?

Best regards

Hello,

You should be able to write your own version of this function by copying our code from OrangutanLCD.cpp. I think that if you change

    send_data(pgm_read_byte(picture_p+i));

to

    send_data(picture_p[i]);

then it will work with a normal string instead of a flash string.

However, note that you will have to call clear() every time you update the characters, which means that it is impossible to do any kind of smooth animation effects.

-Paul

Hi paul,

thanks for your answer. The problem is that i’m working in C, and those functions are on C++.
i tried to convert loadCustomCharacter to C, but i failed to do the same on “send_data” functions. Any suggestion?

Best regards

P.S.: i managed to build my program in C++, using the changes you said. And it didn’t work…it seems like when i’m printing the custom character, it brings trash and it’s completly different from my custom character…

Hello,

The send_data function is defined in OrangutanLCD.h as follows:

static inline void send_data(unsigned char data)
{
	send(data, 1, 2);
}

To convert that to C, just put it in your C file and take out the word “static”. Similarly, you will need to copy the function send() and a few other functions over. If you run into any problems, maybe you should post the specific error message along with your complete code?

-Paul