#include #include #include U8X8_SSD1306_128X64_4W_SW_SPI u8x8(/* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); //U8X8_SSD1306_128X64_4W_HW_SPI u8x8(/* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); //U8X8_SSD1306_128X64_3W_SW_SPI u8x8(/* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* reset=*/ 8); //U8X8_SSD1306_128X64_6800 u8x8(13, 11, 2, 3, 4, 5, 6, A4, /*enable=*/ 7, /*cs=*/ 10, /*dc=*/ 9, /*reset=*/ 8); //U8X8_SSD1306_128X64_8080 u8x8(13, 11, 2, 3, 4, 5, 6, A4, /*enable=*/ 7, /*cs=*/ 10, /*dc=*/ 9, /*reset=*/ 8); void setup(void) { u8x8.begin(); } void pre(void) { u8x8.setFont(u8x8_font_amstrad_cpc_f); u8x8.clear(); u8x8.inverse(); u8x8.print(" U8x8 Library "); u8x8.setFont(u8x8_font_chroma48medium8_r); u8x8.noInverse(); u8x8.setCursor(0,1); } void draw_bar(uint8_t c, uint8_t is_inverse) { uint8_t r; u8x8.setInverseFont(is_inverse); for( r = 0; r < u8x8.getRows(); r++ ) { u8x8.setCursor(c, r); u8x8.print(" "); } } void draw_ascii_row(uint8_t r, int start) { int a; uint8_t c; for( c = 0; c < u8x8.getCols(); c++ ) { u8x8.setCursor(c,r); a = start + c; if ( a <= 255 ) u8x8.write(a); } } void loop(void) { int i; uint8_t c, r, d; pre(); u8x8.print("github.com/"); u8x8.setCursor(0,2); u8x8.print("olikraus/u8g2"); delay(2000); u8x8.setCursor(0,3); u8x8.print("Tile size:"); u8x8.print((int)u8x8.getCols()); u8x8.print("x"); u8x8.print((int)u8x8.getRows()); delay(2000); pre(); for( i = 19; i > 0; i-- ) { u8x8.setCursor(3,2); u8x8.print(i); u8x8.print(" "); delay(200); } draw_bar(0, 1); for( c = 1; c < u8x8.getCols(); c++ ) { draw_bar(c, 1); draw_bar(c-1, 0); delay(50); } draw_bar(u8x8.getCols()-1, 0); pre(); u8x8.setFont(u8x8_font_amstrad_cpc_f); for( d = 0; d < 8; d ++ ) { for( r = 1; r < u8x8.getRows(); r++ ) { draw_ascii_row(r, (r-1+d)*u8x8.getCols() + 32); } delay(1000); } draw_bar(u8x8.getCols()-1, 1); for( c = u8x8.getCols()-1; c > 0; c--) { draw_bar(c-1, 1); draw_bar(c, 0); delay(50); } draw_bar(0, 0); }