Weird interrupt-triggering behavior

Hey guys! it works! :smiley:
Thanks for helping me!

I'm using the 1.6.5 version.

It's a good solution, but I get it working :stuck_out_tongue:

cashme14:
Well you are right but the one issue which you are not considering is that the Due pins are configured for 3.3v while you are using 5v which not only is creating the interrupt issue but will also damage the MCU. hope this will help

Nope, in the first screenshoot you will see that the output is 5v, but it wasn't connected to the Arduino at that time. I was just testing the zero crossing detector.
In the second screenshoot you will see that the zero crossing signal is 3.2v, which is fine. I took into account the voltage difference and I connected it properly to the Arduino.

Now the magic code....

void setup() {
  pinMode(3, OUTPUT);
  attachInterrupt(22, zero_crosss_int, FALLING);  
}

void zero_crosss_int()  {
  digitalWrite(3, HIGH);
  delayMicroseconds(100);
  digitalWrite(3, LOW);  

}

void loop() {

}

I just changed the input pin!! (7--->22)
I read in another post (ATMEGA Digital Input Characteristics and Hysterisis??? - General Electronics - Arduino Forum) that in some atmega's datasheet "The pins when used as digital inputs have a "Schmitt trigger" characteristic"
So I realized that the pin 7 that I was using was under the "PWM" pin-sector of the board, so I changed to the pin 22 that is under the Digital sector.
I don't know if that claim applies to the Arduino Due, but at least now it works :stuck_out_tongue:
Does anybody knows something about that??