Attaching interrupt to PWM output pin (via arduino HAL) doesn't work, it simply stops sending PWM signal once you do that (as far as I can tell)
I suspect that an interrupt has to be attached to the timer that generates PWM signal, but I dont...
Code here doesn't compile in Arduino 1.8.19, with Teensyduino 1.57
https://www.pjrc.com/teensy/interrupts.html
ISR(TIMER0_OVF_vect)
{
/* Timer 0 overflow */
}
Error:
error: expected constructor, destructor, or type conversion before '('...
Teensy 4.1 generates 240kHz clock/pwm signal that it sends to a target device.
analogWriteFrequency(A9, 240000); //240kHz
analogWrite(A9,128); // duty cycle 50%
And I need to generate interrupt on either rising/falling edge of the sent signal...