Display BitMap on SH1106 OLED with u8g2 Library

I am trying to display a photo Bitmap (byte array) on a SH1106 Oled display using the u8g2 library with an Arduino Uno. 

Can anyone point out what I'm doing wrong? 
Here is the Sketch: Thanks, Mac

// SKETCH NAME: OLED_SH1106_128X64_U8G2_BITMAP_PHOTO.ino
// Testing a AITEWIN ROBOT SH1106 128x64 1.3" Oled display.
// u8g2 Library: https://github.com/olikraus/u8g2/wiki
// https://www.arduino.cc/reference/en/libraries/u8g2/
// Convert photos to (byte arrays) Bitmaps: http://javl.github.io/image2cpp/

// Wiring: SH1106 Oled to Arduino: VCC - +5V, Gnd - Gnd, SCK - SCL, SDA - SDA
// Note: This version has no reset pin.

#include <Arduino.h>
#include <U8g2lib.h>

#ifdef U8X8_HAVE_HW_SPI
#include <SPI.h>
#endif
#ifdef U8X8_HAVE_HW_I2C
#include <Wire.h>
#endif

const unsigned char NaN [] PROGMEM = {
  // 'ohms-law-illustrated, 128x64px
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb1, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xdf, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x40, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0xc2, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x26, 0x00, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0xc2, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x10, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x07, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0xa0, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x04, 0xaa, 0xa2, 0x01, 0x80, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x90, 0x00, 0x3d, 0x0d, 0xc0, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x08, 0x00, 0x40, 0xe6, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x87, 0x60, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x97, 0x80, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x01, 0xb8, 0x80, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x84, 0x06, 0xc8, 0x80, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x84, 0x15, 0x10, 0x80, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x42, 0x2c, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x31, 0x58, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x08, 0xf2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x04, 0x60, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x82, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x1b, 0x10, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x41, 0xbc, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x01, 0xc0, 0x20, 0x00, 0x00, 0x03, 0xf0, 0x00,
  0x00, 0x00, 0x03, 0x08, 0x00, 0x78, 0x60, 0x42, 0x01, 0xc0, 0x02, 0x00, 0x01, 0xc0, 0x00, 0x00,
  0x00, 0x00, 0x30, 0x6c, 0x00, 0x03, 0x87, 0x44, 0x01, 0xc0, 0x21, 0x8f, 0x18, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x60, 0x7c, 0x01, 0x40, 0x22, 0x01, 0xc0, 0x00, 0x00, 0x00,
  0x00, 0x01, 0x00, 0x11, 0x00, 0x00, 0x1c, 0x04, 0x01, 0x40, 0x3c, 0x06, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x02, 0x00, 0x38, 0x80, 0x00, 0x06, 0x08, 0x01, 0x40, 0x10, 0x70, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x01, 0x00, 0x2f, 0xc0, 0x00, 0x01, 0xe0, 0x01, 0x40, 0x08, 0xc0, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x01, 0x00, 0x18, 0x20, 0x00, 0x00, 0x20, 0x01, 0x20, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x01, 0x00, 0x00, 0x60, 0x00, 0x00, 0x0c, 0x0d, 0x38, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x03, 0x0f, 0x38, 0x20, 0x00, 0x0f, 0x80, 0x00, 0x00,
  0x00, 0x20, 0x00, 0x10, 0x00, 0x00, 0x01, 0xfe, 0xc7, 0xb8, 0x80, 0x00, 0x80, 0x10, 0x00, 0x00,
  0x00, 0x80, 0x12, 0x10, 0x00, 0x3f, 0xc8, 0x00, 0x3e, 0xdf, 0x01, 0xc4, 0x00, 0x06, 0x00, 0x00,
  0x02, 0x00, 0x10, 0xd8, 0x00, 0x10, 0x70, 0x00, 0x03, 0xa0, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00,
  0x04, 0x00, 0x04, 0x0f, 0x7e, 0x00, 0x38, 0x00, 0x03, 0xe0, 0x00, 0x00, 0x01, 0xf2, 0x00, 0x00,
  0x08, 0x00, 0x00, 0x80, 0x07, 0xf0, 0x38, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x01, 0xe0, 0x00, 0x00,
  0x08, 0x24, 0x28, 0x0f, 0xc0, 0x01, 0xc1, 0x9f, 0x70, 0xe0, 0x00, 0x00, 0xe0, 0x08, 0x20, 0x00,
  0x08, 0x1a, 0x68, 0x08, 0x00, 0x00, 0x62, 0x45, 0x70, 0xa0, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x08, 0x00, 0x02, 0x20, 0x00, 0x00, 0xe0, 0x00, 0x04, 0x04, 0x00, 0x00, 0x00,
  0x04, 0x00, 0x00, 0x0e, 0x1c, 0x04, 0x30, 0x00, 0x00, 0xf8, 0x00, 0x2e, 0x01, 0x83, 0x00, 0x00,
  0x02, 0x00, 0x00, 0x20, 0x00, 0x78, 0x28, 0x00, 0x03, 0xfe, 0x00, 0x88, 0xc0, 0x09, 0x40, 0x00,
  0x01, 0x00, 0x00, 0x41, 0xc7, 0x38, 0x23, 0x00, 0x18, 0x00, 0xff, 0x0c, 0x0f, 0xc0, 0xc0, 0x00,
  0x00, 0x60, 0x43, 0x40, 0x00, 0x48, 0x42, 0x87, 0xc0, 0x00, 0x10, 0x88, 0x80, 0x00, 0x60, 0x00,
  0x00, 0x04, 0x20, 0x00, 0x00, 0x06, 0x0c, 0x85, 0x00, 0x00, 0x04, 0x84, 0x1f, 0xc7, 0x80, 0x00,
  0x00, 0x04, 0x20, 0x00, 0x00, 0x0c, 0xee, 0x0c, 0x00, 0x00, 0x01, 0xc2, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x08, 0x40, 0x00, 0x00, 0x0c, 0xe0, 0xf0, 0x00, 0x00, 0x00, 0x60, 0xc0, 0x00, 0x00, 0x00,
  0x00, 0x30, 0x80, 0x00, 0x00, 0x0c, 0x5c, 0x40, 0x00, 0x00, 0x00, 0x3e, 0x00, 0xc0, 0x00, 0x00,
  0x00, 0x79, 0x00, 0x00, 0x00, 0x04, 0x39, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x40, 0x80, 0x00, 0x00,
  0x00, 0x8f, 0x00, 0x00, 0x00, 0x02, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x03, 0x10, 0x80, 0x00, 0x00,
  0x00, 0x80, 0x38, 0x00, 0x00, 0x01, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0x00, 0x00, 0x00,
  0x00, 0x3e, 0x08, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x80, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xff, 0xfc,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};

// ***** U8g2 Contructor List (Frame Buffer) *****
// Complete list: https://github.com/olikraus/u8g2/wiki/u8g2setupcpp
// Use U8X8_PIN_NONE if the reset pin is not connected

U8G2_SH1106_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);
// U8G2_SH1106_128X64_NONAME_F_HW_I2C u8g2(U8G2_R2);  //This inverts Bitmap and text

void setup(void) {
  u8g2.begin();
  u8g2.clearBuffer();                   //clear the internal memory
  u8g2.drawBitmap(0, 0, NaN, 128, 64);  //Nan is the above BitMap
  u8g2.sendBuffer();
  delay(4000);                          //View Nan photo for 4 seconds
}

void loop(void) {
  u8g2.clearBuffer();                   // clear the internal memory
  u8g2.setFontMode(0);                  // write solid glyphs (may not need)
  u8g2.setFont(u8g2_font_ncenB08_tr);	  // choose a suitable font
  u8g2.drawStr(20, 20, "HELLO JUDY!");  // write something to the internal memory
  u8g2.drawStr(20, 40, "BYE JUDY!");
  u8g2.drawStr(20, 60, "BC Canada");
  u8g2.sendBuffer();				            // transfer internal memory to the display
  delay(500);
}

Can you describe the problem?

Further, please edit your post, select all code and click the < / > in the tool bar above the edit box. Next save the post. That will prevent funny characters showing and makes it easier for us to copy.

The Bitmap (byte array) I wanted to display only shows as a vertical garbaged column on the left 20% of the screen. After the 4 second delay, the three Hello text lines displays fine.

**By the way, the this test graphics code works perfectly without a BITMAP **

// SKETCH: OLED_SH1106_128X64_GRAPHICS_TEST.ino
// Fred tested 01APRIL2021 works good!
// Test sketch using AITEWIN ROBOT SH1106 128x64 1.3" Oled display.
// Home · olikraus/u8g2 Wiki · GitHub
// SSD1306 contructor codes do not work with the SH1106

/*
Universal 8bit Graphics Library (GitHub - olikraus/u8g2: U8glib library for monochrome displays, version 2)
Copyright (c) 2016, olikraus@gmail.com
All rights reserved.
*/

#include <Arduino.h>
#include <U8g2lib.h>

#ifdef U8X8_HAVE_HW_SPI
#include <SPI.h>
#endif
#ifdef U8X8_HAVE_HW_I2C
#include <Wire.h>
#endif

/*
U8g2lib Example Overview:
Frame Buffer Examples: clearBuffer/sendBuffer.
Fast, but may not work with all Arduino boards because of RAM consumption
Page Buffer Examples: firstPage/nextPage.
Less RAM usage, should work with all Arduino boards.
U8x8 Text Only Example:
No RAM usage, direct communication with display controller. No graphics, 8x8 Text only.
*/

U8G2_SH1106_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);

void u8g2_prepare(void) {
u8g2.setFont(u8g2_font_6x10_tf);
u8g2.setFontRefHeightExtendedText();
u8g2.setDrawColor(1);
u8g2.setFontPosTop();
u8g2.setFontDirection(0);
}

void u8g2_box_frame(uint8_t a) {
u8g2.drawStr( 0, 0, “drawBox”);
u8g2.drawBox(5,10,20,10);
u8g2.drawBox(10+a,15,30,7);
u8g2.drawStr( 0, 30, “drawFrame”);
u8g2.drawFrame(5,10+30,20,10);
u8g2.drawFrame(10+a,15+30,30,7);
}

void u8g2_disc_circle(uint8_t a) {
u8g2.drawStr( 0, 0, “drawDisc”);
u8g2.drawDisc(10,18,9);
u8g2.drawDisc(24+a,16,7);
u8g2.drawStr( 0, 30, “drawCircle”);
u8g2.drawCircle(10,18+30,9);
u8g2.drawCircle(24+a,16+30,7);
}

void u8g2_r_frame(uint8_t a) {
u8g2.drawStr( 0, 0, “drawRFrame/Box”);
u8g2.drawRFrame(5, 10,40,30, a+1);
u8g2.drawRBox(50, 10,25,40, a+1);
}

void u8g2_string(uint8_t a) {
u8g2.setFontDirection(0);
u8g2.drawStr(30+a,31, " 0");
u8g2.setFontDirection(1);
u8g2.drawStr(30,31+a, " 90");
u8g2.setFontDirection(2);
u8g2.drawStr(30-a,31, " 180");
u8g2.setFontDirection(3);
u8g2.drawStr(30,31-a, " 270");
}

void u8g2_line(uint8_t a) {
u8g2.drawStr( 0, 0, “drawLine”);
u8g2.drawLine(7+a, 10, 40, 55);
u8g2.drawLine(7+a2, 10, 60, 55);
u8g2.drawLine(7+a
3, 10, 80, 55);
u8g2.drawLine(7+a*4, 10, 100, 55);
}

void u8g2_triangle(uint8_t a) {
uint16_t offset = a;
u8g2.drawStr( 0, 0, “drawTriangle”);
u8g2.drawTriangle(14,7, 45,30, 10,40);
u8g2.drawTriangle(14+offset,7-offset, 45+offset,30-offset, 57+offset,10-offset);
u8g2.drawTriangle(57+offset2,10, 45+offset2,30, 86+offset*2,53);
u8g2.drawTriangle(10+offset,40+offset, 45+offset,30+offset, 86+offset,53+offset);
}

void u8g2_ascii_1() {
char s[2] = " ";
uint8_t x, y;
u8g2.drawStr( 0, 0, “ASCII page 1”);
for( y = 0; y < 6; y++ ) {
for( x = 0; x < 16; x++ ) {
s[0] = y16 + x + 32;
u8g2.drawStr(x
7, y*10+10, s);
}
}
}

void u8g2_ascii_2() {
char s[2] = " ";
uint8_t x, y;
u8g2.drawStr( 0, 0, “ASCII page 2”);
for( y = 0; y < 6; y++ ) {
for( x = 0; x < 16; x++ ) {
s[0] = y16 + x + 160;
u8g2.drawStr(x
7, y*10+10, s);
}
}
}

void u8g2_extra_page(uint8_t a)
{
u8g2.drawStr( 0, 0, “Unicode”);
u8g2.setFont(u8g2_font_unifont_t_symbols);
u8g2.setFontPosTop();
u8g2.drawUTF8(0, 24, “:sunny: :cloud:”);
switch(a) {
case 0:
case 1:
case 2:
case 3:
u8g2.drawUTF8(a3, 36, “:open_umbrella:”);
break;
case 4:
case 5:
case 6:
case 7:
u8g2.drawUTF8(a
3, 36, “:umbrella:”);
break;
}
}

#define cross_width 24
#define cross_height 24
static const unsigned char cross_bits U8X8_PROGMEM = {
0x00, 0x18, 0x00, 0x00, 0x24, 0x00, 0x00, 0x24, 0x00, 0x00, 0x42, 0x00,
0x00, 0x42, 0x00, 0x00, 0x42, 0x00, 0x00, 0x81, 0x00, 0x00, 0x81, 0x00,
0xC0, 0x00, 0x03, 0x38, 0x3C, 0x1C, 0x06, 0x42, 0x60, 0x01, 0x42, 0x80,
0x01, 0x42, 0x80, 0x06, 0x42, 0x60, 0x38, 0x3C, 0x1C, 0xC0, 0x00, 0x03,
0x00, 0x81, 0x00, 0x00, 0x81, 0x00, 0x00, 0x42, 0x00, 0x00, 0x42, 0x00,
0x00, 0x42, 0x00, 0x00, 0x24, 0x00, 0x00, 0x24, 0x00, 0x00, 0x18, 0x00, };

#define cross_fill_width 24
#define cross_fill_height 24
static const unsigned char cross_fill_bits U8X8_PROGMEM = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x18, 0x64, 0x00, 0x26,
0x84, 0x00, 0x21, 0x08, 0x81, 0x10, 0x08, 0x42, 0x10, 0x10, 0x3C, 0x08,
0x20, 0x00, 0x04, 0x40, 0x00, 0x02, 0x80, 0x00, 0x01, 0x80, 0x18, 0x01,
0x80, 0x18, 0x01, 0x80, 0x00, 0x01, 0x40, 0x00, 0x02, 0x20, 0x00, 0x04,
0x10, 0x3C, 0x08, 0x08, 0x42, 0x10, 0x08, 0x81, 0x10, 0x84, 0x00, 0x21,
0x64, 0x00, 0x26, 0x18, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, };

#define cross_block_width 14
#define cross_block_height 14
static const unsigned char cross_block_bits U8X8_PROGMEM = {
0xFF, 0x3F, 0x01, 0x20, 0x01, 0x20, 0x01, 0x20, 0x01, 0x20, 0x01, 0x20,
0xC1, 0x20, 0xC1, 0x20, 0x01, 0x20, 0x01, 0x20, 0x01, 0x20, 0x01, 0x20,
0x01, 0x20, 0xFF, 0x3F, };

void u8g2_bitmap_overlay(uint8_t a) {
uint8_t frame_size = 28;

u8g2.drawStr(0, 0, “Bitmap overlay”);

u8g2.drawStr(0, frame_size + 12, “Solid / transparent”);
u8g2.setBitmapMode(false /* solid */);
u8g2.drawFrame(0, 10, frame_size, frame_size);
u8g2.drawXBMP(2, 12, cross_width, cross_height, cross_bits);
if(a & 4)
u8g2.drawXBMP(7, 17, cross_block_width, cross_block_height, cross_block_bits);

u8g2.setBitmapMode(true /* transparent*/);
u8g2.drawFrame(frame_size + 5, 10, frame_size, frame_size);
u8g2.drawXBMP(frame_size + 7, 12, cross_width, cross_height, cross_bits);
if(a & 4)
u8g2.drawXBMP(frame_size + 12, 17, cross_block_width, cross_block_height, cross_block_bits);
}

void u8g2_bitmap_modes(uint8_t transparent) {
const uint8_t frame_size = 24;

u8g2.drawBox(0, frame_size * 0.5, frame_size * 5, frame_size);
u8g2.drawStr(frame_size * 0.5, 50, “Black”);
u8g2.drawStr(frame_size * 2, 50, “White”);
u8g2.drawStr(frame_size * 3.5, 50, “XOR”);

if(!transparent) {
u8g2.setBitmapMode(false /* solid /);
u8g2.drawStr(0, 0, “Solid bitmap”);
} else {
u8g2.setBitmapMode(true /
transparent*/);
u8g2.drawStr(0, 0, “Transparent bitmap”);
}
u8g2.setDrawColor(0);// Black
u8g2.drawXBMP(frame_size * 0.5, 24, cross_width, cross_height, cross_bits);
u8g2.setDrawColor(1); // White
u8g2.drawXBMP(frame_size * 2, 24, cross_width, cross_height, cross_bits);
u8g2.setDrawColor(2); // XOR
u8g2.drawXBMP(frame_size * 3.5, 24, cross_width, cross_height, cross_bits);
}

uint8_t draw_state = 0;

void draw(void) {
u8g2_prepare();
switch(draw_state >> 3) {
case 0: u8g2_box_frame(draw_state&7); break;
case 1: u8g2_disc_circle(draw_state&7); break;
case 2: u8g2_r_frame(draw_state&7); break;
case 3: u8g2_string(draw_state&7); break;
case 4: u8g2_line(draw_state&7); break;
case 5: u8g2_triangle(draw_state&7); break;
case 6: u8g2_ascii_1(); break;
case 7: u8g2_ascii_2(); break;
case 8: u8g2_extra_page(draw_state&7); break;
case 9: u8g2_bitmap_modes(0); break;
case 10: u8g2_bitmap_modes(1); break;
case 11: u8g2_bitmap_overlay(draw_state&7); break;
}
}

void setup(void) {
u8g2.begin();
}

void loop(void) {
// picture loop
u8g2.clearBuffer();
draw();
u8g2.sendBuffer();

// increase the state
draw_state++;
if ( draw_state >= 12*8 )
draw_state = 0;

// deley between each page
delay(200); //default 100

}Preformatted text