Skip to content

Instantly share code, notes, and snippets.

@Isaac-the-Man
Created April 20, 2019 06:55
Show Gist options
  • Save Isaac-the-Man/baf3e9b7b9ec7b0318eef59543515c07 to your computer and use it in GitHub Desktop.
Save Isaac-the-Man/baf3e9b7b9ec7b0318eef59543515c07 to your computer and use it in GitHub Desktop.
#include "U8g2lib.h"
// change to your own constructor
U8G2_SH1106_128X64_NONAME_1_SW_I2C oled(U8G2_R0, A5, A4);
// replace this array with your own xbm array
static unsigned char new_logo_bits[] = {
0x00, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff,
0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x03, 0x00, 0x00,
0x00, 0x00, 0x7f, 0x00, 0xe0, 0x0f, 0x00, 0x00, 0x00, 0xc0, 0x0f, 0x00,
0x00, 0x3f, 0x00, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0x7c, 0x00, 0x00,
0x00, 0xf8, 0x00, 0x00, 0x00, 0xf0, 0x01, 0x00, 0x00, 0x3c, 0x00, 0x00,
0x00, 0xc0, 0x03, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x80, 0x07, 0x00,
0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x80, 0x07, 0x00, 0x00,
0x00, 0x00, 0x1e, 0x00, 0xc0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x00,
0xc0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0xe0, 0x00, 0x00, 0x00,
0x00, 0x00, 0x70, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00,
0x70, 0x00, 0x00, 0x1c, 0x80, 0x03, 0xe0, 0x00, 0x38, 0x00, 0x00, 0x1e,
0x80, 0x03, 0xc0, 0x01, 0x38, 0x00, 0x00, 0x1e, 0xc0, 0x03, 0xc0, 0x01,
0x1c, 0x00, 0x00, 0x0e, 0xc0, 0x03, 0x80, 0x03, 0x1c, 0x00, 0x00, 0x0f,
0xc0, 0x01, 0x80, 0x03, 0x0c, 0x00, 0x00, 0x0f, 0xe0, 0x01, 0x00, 0x03,
0x0e, 0x00, 0x00, 0x0f, 0xe0, 0x01, 0x00, 0x07, 0x0e, 0x00, 0xfc, 0xff,
0xff, 0x1f, 0x00, 0x07, 0x06, 0x00, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x06,
0x06, 0x00, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x06, 0x07, 0x00, 0xff, 0xff,
0xff, 0x3f, 0x00, 0x0e, 0x07, 0x00, 0xc0, 0x03, 0x70, 0x00, 0x00, 0x0e,
0x07, 0x00, 0xc0, 0x03, 0x78, 0x00, 0x00, 0x0e, 0x07, 0x00, 0xc0, 0x03,
0x78, 0x00, 0x00, 0x0e, 0x07, 0x00, 0xc0, 0x01, 0x78, 0x00, 0x00, 0x0e,
0x07, 0x00, 0xe0, 0x01, 0x38, 0x00, 0x00, 0x0e, 0x07, 0x00, 0xe0, 0x01,
0x3c, 0x00, 0x00, 0x0e, 0x07, 0x00, 0xe0, 0x00, 0x3c, 0x00, 0x00, 0x0e,
0x07, 0x00, 0xf0, 0x00, 0x3c, 0x00, 0x00, 0x0e, 0x07, 0xc0, 0xff, 0xff,
0xff, 0x0f, 0x00, 0x0e, 0x06, 0xc0, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x06,
0x06, 0xc0, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x06, 0x0e, 0x00, 0x78, 0x00,
0x1f, 0x00, 0x00, 0x07, 0x0e, 0x00, 0x38, 0x00, 0x0f, 0x00, 0x00, 0x07,
0x0c, 0x00, 0x3c, 0x00, 0x0f, 0x00, 0x00, 0x03, 0x1c, 0x00, 0x3c, 0x00,
0x0f, 0x00, 0x80, 0x03, 0x1c, 0x00, 0x3c, 0x80, 0x07, 0x00, 0x80, 0x03,
0x38, 0x00, 0x1c, 0x80, 0x07, 0x00, 0xc0, 0x01, 0x38, 0x00, 0x1e, 0x80,
0x07, 0x00, 0xc0, 0x01, 0x70, 0x00, 0x1e, 0x80, 0x03, 0x00, 0xe0, 0x00,
0x70, 0x00, 0x00, 0x00, 0x01, 0x00, 0xe0, 0x00, 0xe0, 0x00, 0x00, 0x00,
0x00, 0x00, 0x70, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00,
0xc0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x80, 0x07, 0x00, 0x00,
0x00, 0x00, 0x1e, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00,
0x00, 0x1e, 0x00, 0x00, 0x00, 0x80, 0x07, 0x00, 0x00, 0x3c, 0x00, 0x00,
0x00, 0xc0, 0x03, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0xf0, 0x01, 0x00,
0x00, 0xe0, 0x03, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0xc0, 0x0f, 0x00,
0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x00, 0xe0, 0x0f, 0x00, 0x00,
0x00, 0x00, 0xfc, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff,
0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00, 0x00 };
void setup(void) {
oled.begin();
}
void loop(void) {
oled.firstPage();
do {
oled.setFont(u8g2_font_guildenstern_nbp_tf);
oled.drawStr(80,22,"Simply");
oled.drawStr(80,39,"Code");
oled.drawStr(80,55,"Based");
oled.drawXBM(4,4,60,60,new_logo_bits); // draw out the image
} while(oled.nextPage());
delay(3500);
oled.firstPage();
do {
oled.setFont(u8g2_font_guildenstern_nbp_tf);
oled.drawStr(10,10,"This is a sample");
oled.drawStr(10,25,"display of 1.3in");
oled.drawStr(10,40,"OLED display board");
oled.drawStr(10,55,"simplycodebased.org");
} while(oled.nextPage());
delay(3500);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment