i need help about aspot welder code

i am a beginner, i put together a code from different sources;
but i don’t know how to make the number corresponding to (position), to an out put pulse time due to a switch activation
plz some help

#include <Wire.h>
#include <Adafruit_SSD1306.h>
#include <Adafruit_GFX.h>
#include "EncoderStepCounter.h"

#define OLED_WIDTH 128
#define OLED_HEIGHT 64
#define OLED_ADDR   0x3C
#define ENCODER_PIN1 2
#define ENCODER_INT1 digitalPinToInterrupt(ENCODER_PIN1)
#define ENCODER_PIN2 3
#define ENCODER_INT2 digitalPinToInterrupt(ENCODER_PIN2)

//int SWITCH = 7;
//int SSR = 13;

EncoderStepCounter encoder(ENCODER_PIN1, ENCODER_PIN2);

Adafruit_SSD1306 display(OLED_WIDTH, OLED_HEIGHT);
void setup() {
  Serial.begin(9600);
  display.begin(SSD1306_SWITCHCAPVCC, OLED_ADDR);
  display.clearDisplay();

  display.setTextSize(2);
  display.setTextColor(WHITE);
  display.setCursor(0, 0);
  display.println("Welcome");
  display.setTextSize(2);
  display.setTextColor(WHITE);
  display.setCursor(0, 17);
  display.println("This is");
  display.println("a Spot");
  display.println("welder");

  display.display();

  delay(3000);
  
  encoder.begin();
  
  attachInterrupt(ENCODER_INT1, interrupt, CHANGE);
  attachInterrupt(ENCODER_INT2, interrupt, CHANGE);
}

void interrupt() {
  encoder.tick();
}
signed long position = 0;


void loop() {
  signed char pos = encoder.getPosition();
  if (pos != 0) {
    position += pos;
    encoder.reset();
    Serial.println(position);
  }
display.clearDisplay();

   display.setTextSize(2);
  display.setTextColor(WHITE);
  display.setCursor(0, 0);
  display.println("pluse:");
   display.setTextSize(4);
  display.setTextColor(WHITE);
  display.setCursor(50, 30);
  display.println(position);

  display.display(); 



}

spot_welder.ino (1.59 KB)

What is the physical relationship between encoder ticks and distance in your system?

For example, suppose you had bicycle the wheels of which are 670mm in diameter for a circumference of 2104.9mm. If you had a quadrature encoder with 1024 ticks per rotation, each tick would represent 2.05mm of distance.

In your mechanical system, you have your encoder hooked up to "something" and want to measure something else: What's the relationship and how do you want to use it?

I'm not sure anyone understands what you are asking. There are sub-forums in other languages located here. You might get better help there.