int buttonPin = 2;
int batteryPin = A0;

#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define SCREEN_WIDTH 128  // OLED display width, in pixels
#define SCREEN_HEIGHT 64  // OLED display height, in pixels

#define OLED_RESET -1
#define SCREEN_ADDRESS 0x3C  //Hey hey! Here’s the I2C address you may need to change! Change “0x3C” to the address of your particular screen.
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

void setup() {
  Serial.begin(9600);
  if (!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) {
    Serial.println(F("SSD1306 allocation failed"));
    for (;;)
      ;
  }
  display.display();
  delay(2000);
  display.clearDisplay();

  pinMode(buttonPin, INPUT_PULLUP);
  pinMode(batteryPin, INPUT);
}

void loop() {
  display.setTextSize(2);
  display.setTextColor(SSD1306_WHITE);
  display.setCursor(0, 0);
  display.println("Voltage:");
  if (digitalRead(buttonPin) == LOW) {
    int ADCVal = analogRead(batteryPin);
    float rawV = ADCVal * 0.0048828125;
    float realV = rawV / ENTERVALUE;  //Replace “ENTERVALUE” with whatever you ended up with after doing R2/(R1+R2) with your specific resistors!
    display.print(realV);
    display.println(" V");
    if (realV < 2.85) {
      display.print("BAD");
    } else {
      display.print("GOOD");
    }
  }
  display.display();
  delay(250);
  display.clearDisplay();
}
