Make sure you add
// SW SPI Com: SCK = 15, MOSI = 16, CS = 12, DC = 4, RST = 6
U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(15, 16, 12, 4, 6);
to the top of the source file somewhere, under the header definitions and above or below that big comment blog at the beginning of the file.
That is the constructor call to setup the library so it can draw to the screen. the u8g
is being defined in this line. There is a long list of commented out constructors to choose from, this one is custom, but should work.
Mine looks like:
//U8GLIB_SSD1351_128X128_HICOLOR u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
//U8GLIB_SSD1351_128X128GH_332 u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (Freetronics OLED)
//U8GLIB_SSD1351_128X128GH_HICOLOR u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (Freetronics OLED)
// DOGS102 shield configuration values
// uint8_t uiKeyPrev = 2;
// uint8_t uiKeyNext = 4;
// uint8_t uiKeySelect = 5;
// uint8_t uiKeyBack = 3;
// DOGM128-Shield configuration values
// DOGXL60-Shield configuration values
U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(15, 16, 12, 4, 6); // <- Here is the added line
uint8_t uiKeyPrev = A2;
uint8_t uiKeyNext = A1;
uint8_t uiKeySelect = 7;
uint8_t uiKeyBack = 8;
And in the setup()
function (line 197 about), comment out u8g.setRot180();
so that it looks like the following:
void setup() {
// rotate screen, if required
//u8g.setRot180();
uiSetup();
chess_Init(u8g.getU8g(), 0);
}