Adjusting the motor angle according to the measurement with Infrared Speed Senso

Hello to everyone, I am measuring the speed with the lm393 infrared speed sensor. But I want to adjust the angles of the servo motor with the parameter I get from the sensor.
I tried many code but it didn't. What is your approach? I need to adjust the angle of the motor according to the speed parameter. How can I use the variable inside the timer? or how do I track a method?

#include <TimerOne.h>
#include<Servo.h>
Servo sg90;
unsigned int sayac=0;
int ena = 10;
void say() // sayma işlemi
{
 sayac++; // sayacı bir arttır
} 
  
void timerIsr()
{
 Timer1.detachInterrupt(); //stop timer
 Serial.print("Motor hızı: "); 
 int devir = (sayac / 6); // 6 is the number of spaces or holes in the encoder. Write the number of holes you have.
 Serial.print(devir,DEC); 
 Serial.println(" Saniyedeki Devir Sayısı"); 
 sayac=0; // reset counter
 Timer1.attachInterrupt( timerIsr ); //enable timer
}
  
void setup() 
{
 Serial.begin(9600);
 sg90.attach(7);
  
 pinMode(ena, OUTPUT);
 Timer1.initialize(1000000); // set timer to one second
 attachInterrupt(0, say, RISING); //Counter increment when sensor pin is high.
 Timer1.attachInterrupt( timerIsr ); // Enable timerIsr timer
} 
  
void loop()
{
  sg90.write(0);
}

You can't use print() inside and ISR. Your timerIsr() function should only set a flag (or two) and your main code should do all the processing/printing.

And the Servo library uses Timer1 so you also messing with Timer1 interrupts is probably not going to work out well.

Steve

#include <TimerOne.h>
#include<Servo.h>
Servo sg90;
unsigned int sayac=0;
int ena = 10;
int devir;
void say() // sayma işlemi
{
 sayac++; // sayacı bir arttır
} 
  
void timerIsr()
{
 Timer1.detachInterrupt(); //stop timer
 Serial.print("Motor Speed: "); 
 devir = (sayac / 6); // 6 is the number of spaces or holes in the encoder. Write the number of holes you have.
 Serial.print(devir,DEC); 
 Serial.println(" Saniyedeki Devir Sayısı"); 
 sayac=0; // reset counter
 Timer1.attachInterrupt( timerIsr ); //enable timer
}
  
void setup() 
{
 Serial.begin(9600);
 sg90.attach(7);
  
 pinMode(ena, OUTPUT);
 Timer1.initialize(1000000); // set timer to one second
 attachInterrupt(0, say, RISING); //Counter increment when sensor pin is high.
 Timer1.attachInterrupt( timerIsr ); // Enable timerIsr timer
} 
  
void loop()
{
  if(devir==0){
    sg90.write(0);
 
  }
  if(devir>2){
    sg90.write(180);
  }
}

greetings again;
the above code block worked. Is the transaction coincidence? Is there any possibility of working?