#include <Wire.h>
#include <Adafruit_SSD1306.h>
#include <U8g2lib.h>



#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels



// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
// The pins for I2C are defined by the Wire-library. 
// On an arduino UNO:       A4(SDA), A5(SCL)
// On an arduino MEGA 2560: 20(SDA), 21(SCL)
// On an arduino LEONARDO:   2(SDA),  3(SCL), ...
#define OLED_RESET     4 // Reset pin # (or -1 if sharing Arduino reset pin)
#define SCREEN_ADDRESS 0x3C ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32
//Adafruit_SSD1306 oled(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

//U8X8_SSD1306_128X64_NONAME_HW_I2C oled(/* reset=*/ U8X8_PIN_NONE);
//U8G2 oled();
U8G2_SSD1306_128X64_NONAME_1_SW_I2C oled(U8G2_R0, A5, A4);


unsigned int val[7];
byte i;

const unsigned char PROGMEM check_off[] = { 0x00, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00 };
const unsigned char PROGMEM check_on[]  = { 0x00, 0x3c, 0x7e, 0x7e, 0x7e, 0x7e, 0x3c, 0x00 };







//void draw_check_off(U8X8_SSD1306_128X64_NONAME_HW_I2C oled, uint8_t x, uint8_t y)
void draw_check_off(U8G2 oled, uint8_t x, uint8_t y)
{
    oled.setDrawColor(WHITE);

    // verticals
    oled.drawLine(x+2, y+2, x+2, y+5);
    //oled.drawLine(x+5, y+2, x+5, y+5, WHITE);

    // horizontals
    //oled.drawLine(x+3, y+1, x+4, y+1, WHITE);
    //oled.drawLine(x+3, y+6, x+4, y+6, WHITE);
}




void draw_check_on(U8G2 oled, uint8_t x, uint8_t y)
{
    // verticals
    oled.drawLine(x+2, y+2, x+2, y+5);
    oled.drawLine(x+5, y+2, x+5, y+5);

    // horizontals
    for (uint8_t i=1; i<7; i++)
      oled.drawLine(x+3, y+i, x+4, y+i);

    //oled.drawLine(x+2, y+1, x+5, y+1, WHITE);
    //oled.drawLine(x+2, y+6, x+5, y+6, WHITE);
}




void setup()
{
  Serial.begin(9600);
  //oled.begin(SSD1306_EXTERNALVCC, SCREEN_ADDRESS);
  oled.setI2CAddress(0x3c);
  oled.begin();
  oled.clearDisplay();
  //oled.setFont(u8x8_font_artossans8_r);

  int i, j;

  /*for (i=16; i<128; i+=24)
  {
    for (j=0; j<64; j+=8)
    {
      if (((i+j)/8) % 2)
      {
        oled.drawBitmap(i, j, check_off, 8, 8, WHITE);
      } else
      {
        oled.drawBitmap(i, j, check_on, 8, 8, WHITE);
      }
    }
  }*/

  oled.setDrawColor(WHITE);
  oled.drawBox(0,0,127,13);
  /*oled.setTextColor(BLACK);
  /*oled.setCursor(1,1);
  oled.print("MOTOR: ");
  oled.print(5);*/

  //oled.setTextColor(WHITE);

  draw_check_off(oled, 18,10);
  //draw_check_off(oled, 6,10);
  //draw_check_off(oled, 12,10);
  //draw_check_on(oled, 18,18);

  oled.setFont(u8g2_font_6x12_tf);

  oled.setCursor(0,10);
  oled.print("LS1");
  oled.setCursor(32,10);
  oled.print("LS2");
  oled.setCursor(0,18);
  oled.print("LS3");
  oled.setCursor(32,18);
  oled.print("LS4");
  oled.setCursor(0,26);
  oled.print("SPEED_PWM: 9999");
  
  oled.display();
}


unsigned long t_start = 0;

void loop()
{

}
Loading
ssd1306