如果出现utility/u8g.h: No such file or directory 这个错误是因为新版的U8glib 库已经把utility改成clib ,因此 改成如下即可
#include "U8glib.h"
#include "clib/u8g.h"
U8GLIB_SSD1306_128X64 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE);
const uint8_t bitmap_z [] U8G_PROGMEM ={
0x00,0x00,0x01,0x80,0x03,0x80,0x3F,0xBC,0x7F,0xBE,0x73,0xCE,0x63,0xCE,0x63,0xCE,
0x63,0xCE,0x7B,0x9E,0x7F,0xBE,0x3F,0xBC,0x1F,0xB8,0x03,0x80,0x03,0x80,0x01,0x80
};
const uint8_t bitmap_w [] U8G_PROGMEM ={
0x00,0x00,0x07,0xC0,0x3F,0xD8,0x7C,0x7E,0x7F,0xFE,0x00,0x00,0x1C,0x3C,0x1C,0x38,
0x0E,0x70,0x0F,0xF0,0x07,0xA0,0x0B,0xE0,0x3D,0xFC,0x7E,0xFE,0x7C,0x3E,0x30,0x00
};
void draw(void) {
u8g.setColorIndex(1);
u8g.drawBitmapP ( 0 , 0 , 2 , 16 , bitmap_z);
u8g.drawBitmapP ( 17 , 0 , 2 , 16 , bitmap_w );
}
void setup() {
}
void loop() {
u8g.firstPage();
do {
draw();
} while( u8g.nextPage() );
}