-
Notifications
You must be signed in to change notification settings - Fork 42
/
8.3.7-u8gDrawXBMP.ino
39 lines (34 loc) · 1.06 KB
/
8.3.7-u8gDrawXBMP.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*
使用u8glib显示位图
图形显示器:OpenJumper MINI 12864
控制器:Arduino UNO
*/
#include "U8glib.h"
U8GLIB_MINI12864 u8g(10, 9, 8);
/*宽度x高度=96x64*/
#define width 96
#define height 64
static unsigned charbitmap[] U8G_PROGMEM = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x80,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0xF0,0x00,0x00,0xE0,0xFF,0xFF,0x1F,
0x00,0x78,0x00,0x00,0x00,0xF0,0x1F,0x00,0x7C,0x00,0x00,0xFC,0xC0,0x7F,0x00,0x00,
//为节约篇幅,此处代码省略
0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,
0xFF,0xFF,0xFF,0xFF,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0xFF,0xFF,0xFF,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,};
void draw(void) {
// graphic commands to redraw the complete screen should be placed here
u8g.drawXBMP( 0, 0, width, height, bitmap);
}
void setup(void) {
}
void loop(void)
{
u8g.firstPage();
do
{
draw();
} while( u8g.nextPage() );
// 延时一定时间,再重绘图片
delay(500);
}