user6549: i am using Arduino Mega.. ANd this is the code:  
void bump(void);

void setup() 
{
    pinMode(19,INPUT);
    attachInterrupt(4,bump,HIGH);
    pinMode(13,OUTPUT);
}

void loop() 
{

}

void bump()
{
   for(float i = 0; i < 90000; i++){
   digitalWrite(13,HIGH);
   }
   for(float i = 0; i < 10000; i++){
   digitalWrite(13,LOW);
   }

}  

Although i give +5 V to it once, the LED will blink twice...!
What is the solution?

user6549: After wondering over it for quite a long time, I finally came to the conclusion, that the interrupt should be made to trigger at RISING edge, if I want it to go into ISR the moment it gets HIGH. 
Hence the setup line was change to   
attachInterrupt(4,bump,RISING);

And the cod e works well.
I suppose that is because, when it receives a HIGH signal, than the period for which it receives HIGH is a bit long, during which it adds another interrupt into the queue, and so the ISR is executed once again.

6549: <p>i am using Arduino Mega.. ANd this is the code:  </p>

<pre><code>void bump(void);

void setup() 
{
    pinMode(19,INPUT);
    attachInterrupt(4,bump,HIGH);
    pinMode(13,OUTPUT);
}

void loop() 
{

}

void bump()
{
   for(float i = 0; i &lt; 90000; i++){
   digitalWrite(13,HIGH);
   }
   for(float i = 0; i &lt; 10000; i++){
   digitalWrite(13,LOW);
   }

}  
</code></pre>

<p>Although i give +5 V to it once, the LED will blink twice...!
What is the solution?</p>
 6549: <p>After wondering over it for quite a long time, I finally came to the conclusion, that the interrupt should be made to trigger at RISING edge, <strong>if I want it to go into ISR the moment it gets HIGH.</strong> </p>

<p>Hence the setup line was change to   </p>

<pre><code>attachInterrupt(4,bump,RISING);
</code></pre>

<p>And the cod e works well.<br>
I suppose that is because, when it receives a HIGH signal, than the period for which it receives HIGH is a bit long, during which it adds another interrupt into the queue, and so the ISR is executed once again.</p>
