show button states on 0.9 oled display

Hi,
I would to create a simple application to show on display the state o button but I do not know how to do it
This is my code

#include <Wire.h>              
#include <Adafruit_GFX.h>      
#include <Adafruit_SSD1306.h>  
#define SCREEN_WIDTH 128 
#define SCREEN_HEIGHT 64
 
#define OLED_RESET  4    
Adafruit_SSD1306 display(OLED_RESET);
 const int ledpin = 6;
const int interruptPin = 2;
volatile boolean ledOn = false;
void setup(void)
{
   pinMode (ledpin, OUTPUT);
   attachInterrupt(digitalPinToInterrupt(interruptPin),function1, FALLING);

  delay(1000);  // wait a second
 
  // initialize the SSD1306 OLED display with I2C address = 0x3D
  display.begin(SSD1306_SWITCHCAPVCC, 0x3c);
 
  // clear the display buffer.
  display.clearDisplay();
 
  display.setTextSize(1);   
  display.setTextColor(WHITE, BLACK); 
  display.setCursor(20, 0);            
  display.print("button");
  display.setCursor(15, 15);
   display.print(ledOn);
  display.display();        // update the display
  display.setTextSize(1);   // text size = 1
}
 void loop() {
}
void function1()
{
  if (ledOn)
  {
    ledOn = false;
    digitalWrite(ledpin, LOW);
    delay (200);
  }
else
{
  ledOn = true;
  digitalWrite(ledpin, HIGH);
  delay (200);
}
 
}

 
// end of code.

That code blinks an LED 2.5 times per second. What is the button supposed to do?

That code make the led "on" when the button is push. The status of button is tracked by interrupt function

In Your poste code the ISR, Interrupt Service Routine does not show up but using "select" and copying to IDE I can se it.
To use Interrupt for detecting a button press is a huge overkill and misuse of resources but never mind. If it works, it works.
The button is pressed during a short time. Do You want to show that short moment? If You want to show the state, the result of the button pressing the print out ledOn.

Using delay() in an ISR is generally really bad. Don't do it. While inside the ISR Interrupts needed for mills() and also delay might be affected and cause problems.

Railroader:
Using delay() in an ISR is generally really bad. Don't do it. While inside the ISR Interrupts needed for mills() and also delay might be affected and cause problems.

Yes, what actually happens is that inside an ISR, you can read millis() and micros() but the value never changes while you are in it. The delay() function uses micros() so it will probably run forever if called from there.