#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SH110X.h>
#include <Fonts/FreeSans9pt7b.h>

#define i2c_Address 0x3C // Change this if your OLED has a different I2C address
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
#define OLED_RESET -1

Adafruit_SH1106G display = Adafruit_SH1106G(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

void setup() {
  Serial.begin(9600);

  if(!display.begin(i2c_Address)) {
    Serial.println(F("SH110X allocation failed"));
    for(;;);
  }
  display.clearDisplay();
}

void loop() {
  display.clearDisplay();

  // Set a larger text size and color
  //display.setTextSize(3);  // Increase the text size
  display.setFont(&FreeSans9pt7b);
  display.setTextColor(SH110X_WHITE);

  // Get the width and height of the text
  int16_t x1, y1;
  uint16_t w, h;
  display.getTextBounds("BOLT", 0, 0, &x1, &y1, &w, &h);

  // Calculate the X and Y coordinates for centering
  int16_t x = (SCREEN_WIDTH - w) / 2;
  int16_t y = (SCREEN_HEIGHT - h) / 2;

  // Display "BOLT" in the center of the screen
  display.setCursor(x, y);
  display.print("BOLT");

  // Update the display
  display.display();

  // Delay for a while
  delay(2000);
}
