Hello!
I've succesfully setup a ST7920 using the u8glib library. Now I would like to display a small image. The bitmap.pde example taken from the library works well. It draws a little castle, like this:
I've found this software that should allow me to convert an image to hex:
Start with an example, the file in attach is a small png in monochrome.
This, imported in the software, converted to hex, gives me as result:
0x0,0x0,0x0,0x0,0x7e,0x0,0x0,0x0,0x0,0x1,0xff,0xc0,0x0,0x0,0x0,0x7,0xff,0xe0,0x0,0x0,0x0,0xf,0xff,0xf0,0x0,0x0,0x0,0x1f,0xff,0xf8,0x0,0x0,0x0,0x3f,0xc3,0xfc,0x0,0x0,0x0,0x7f,0x0,0xfe,0x0,0x0,0x0,0x7e,0x0,0x7e,
0x0,0x0,0x0,0x7c,0x0,0x3e,0x0,0x0,0x0,0xfc,0x0,0x1f,0x0,0x0,0x0,0xf8,0x0,0x1f,0x7f,0xff,0xff,0xff,0xf0,0x1f,0xff,0xff,0xff,0xff,0xf8,0x1f,0xff,0xff,0xff,0xff,0xf8,0x1f,0x7f,0xff,0xff,0xff,0xf0,0x1f,0x3f,0xff,0xff,0xff,0xe0,0x3e,
0x1f,0xff,0xff,0xff,0xc0,0x7e,0xf,0xff,0xff,0xff,0x80,0xfe,0x7,0xff,0xff,0xff,0xc3,0xfc,0x3,0xff,0xff,0xff,0xff,0xf8,0x1,0xff,0xff,0xff,0xff,0xf0,0x0,0xff,0xff,0xff,0xff,0xe0,0x0,0x7f,0xff,0xf3,0xff,0xc0,0x0,0x3f,0xff,0xe0,0x7e,0x0,
0x0,0x1f,0xff,0xc0,0x0,0x0,0x0,0xf,0xff,0x80,0x0,0x0,0x0,0x7,0xff,0x0,0x0,0x0,0x0,0x3,0xfe,0x0,0x0,0x0,0x0,0x3,0xfe,0x0,0x0,0x0,0x0,0x1,0xfc,0x0,0x0,0x0,0x0,0x0,0xf8,0x0,0x0,0x0,0x0,0x0,0xf8,0x0,0x0,0x0,
0x0,0x0,0xf8,0x0,0x0,0x0,0x0,0x0,0xf8,0x0,0x0,0x0,0x0,0x0,0xf8,0x0,0x0,0x0,0x0,0x0,0xf8,0x0,0x0,0x0,0x0,0x0,0xf8,0x0,0x0,0x0,0x0,0x0,0xf8,0x0,0x0,0x0,0x0,0x0,0xf8,0x0,0x0,0x0,0x0,0x0,0xf8,0x0,0x0,0x0,
0x0,0x0,0xf8,0x0,0x0,0x0,0x0,0x0,0xf8,0x0,0x0,0x0,0x0,0x1,0xfc,0x0,0x0,0x0,0x1,0xff,0xff,0xfc,0x0,0x0,0x3,0xff,0xff,0xfe,0x0,0x0,0x3,0xff,0xff,0xfe,0x0,0x0,0x3,0xff,0xff,0xfe,0x0,0x0,0x1,0xff,0xff,0xfc,0x0,0x0
And here the complete skatch I'm using, starting from the 'bitmap.pde' example contained in the library:
#include "U8glib.h"
U8GLIB_ST7920_128X64 u8g(7, 6, 5, U8G_PIN_NONE);
const uint8_t cocktail[] PROGMEM = {
0x0,0x0,0x0,0x0,0x7e,0x0,0x0,0x0,0x0,0x1,0xff,0xc0,0x0,0x0,0x0,0x7,0xff,0xe0,0x0,0x0,0x0,0xf,0xff,0xf0,0x0,0x0,0x0,0x1f,0xff,0xf8,0x0,0x0,0x0,0x3f,0xc3,0xfc,0x0,0x0,0x0,0x7f,0x0,0xfe,0x0,0x0,0x0,0x7e,0x0,0x7e,
0x0,0x0,0x0,0x7c,0x0,0x3e,0x0,0x0,0x0,0xfc,0x0,0x1f,0x0,0x0,0x0,0xf8,0x0,0x1f,0x7f,0xff,0xff,0xff,0xf0,0x1f,0xff,0xff,0xff,0xff,0xf8,0x1f,0xff,0xff,0xff,0xff,0xf8,0x1f,0x7f,0xff,0xff,0xff,0xf0,0x1f,0x3f,0xff,0xff,0xff,0xe0,0x3e,
0x1f,0xff,0xff,0xff,0xc0,0x7e,0xf,0xff,0xff,0xff,0x80,0xfe,0x7,0xff,0xff,0xff,0xc3,0xfc,0x3,0xff,0xff,0xff,0xff,0xf8,0x1,0xff,0xff,0xff,0xff,0xf0,0x0,0xff,0xff,0xff,0xff,0xe0,0x0,0x7f,0xff,0xf3,0xff,0xc0,0x0,0x3f,0xff,0xe0,0x7e,0x0,
0x0,0x1f,0xff,0xc0,0x0,0x0,0x0,0xf,0xff,0x80,0x0,0x0,0x0,0x7,0xff,0x0,0x0,0x0,0x0,0x3,0xfe,0x0,0x0,0x0,0x0,0x3,0xfe,0x0,0x0,0x0,0x0,0x1,0xfc,0x0,0x0,0x0,0x0,0x0,0xf8,0x0,0x0,0x0,0x0,0x0,0xf8,0x0,0x0,0x0,
0x0,0x0,0xf8,0x0,0x0,0x0,0x0,0x0,0xf8,0x0,0x0,0x0,0x0,0x0,0xf8,0x0,0x0,0x0,0x0,0x0,0xf8,0x0,0x0,0x0,0x0,0x0,0xf8,0x0,0x0,0x0,0x0,0x0,0xf8,0x0,0x0,0x0,0x0,0x0,0xf8,0x0,0x0,0x0,0x0,0x0,0xf8,0x0,0x0,0x0,
0x0,0x0,0xf8,0x0,0x0,0x0,0x0,0x0,0xf8,0x0,0x0,0x0,0x0,0x1,0xfc,0x0,0x0,0x0,0x1,0xff,0xff,0xfc,0x0,0x0,0x3,0xff,0xff,0xfe,0x0,0x0,0x3,0xff,0xff,0xfe,0x0,0x0,0x3,0xff,0xff,0xfe,0x0,0x0,0x1,0xff,0xff,0xfc,0x0,0x0
};
void draw(void) {
// graphic commands to redraw the complete screen should be placed here
u8g.drawBitmapP( 20, 20, 1, 20, cocktail);
}
void setup(void) {
}
void loop(void) {
// picture loop
u8g.firstPage();
do {
draw();
} while( u8g.nextPage() );
// rebuild the picture after some delay
delay(1000);
}
I haven't understood well how the draw syntax works, even if I've read the doc...
u8g.drawBitmapP( 20, 20, 1, 20, cocktail);
I'm additionally not sure if the hex is valid.
Could someone help me?
Thank's!
Simon