im already used 5v by 10k pot as voltage divider.
i tried again
and plotted interrupt function change according to the pin2 voltage
two test made
blue: interrupt function
red : pin2 voltage
on arduino nano

if voltage goes up the interrupt called only one times(when voltage level reached 2,5v)
blue: interrupt function
red : pin2 voltage
on arduino mega

if voltage between 2,3v to 2,5v interrupt goes looping and blue line high
codes
unsigned long delays=0;
int sayi=0, voltage=0,durum2=0;
bool durum=false;
void setup() {
// pinMode(2 ,INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(2), say, RISING);
Serial.begin(9600);
}
void say() { sayi++; durum=true;}
void loop() {
if ((millis()-delays)>=50)
{
delays=millis();
// Serial.print("durum=");
if (durum)
{
durum=false;
durum2=5000;
Serial.print(durum2);
Serial.print(" ");
}
else{
durum2=1000;
Serial.print(durum2);
Serial.print(" ");}
voltage=analogRead(A0);
voltage=map(voltage,0,1023,0,5000);
Serial.println(voltage);
}
}