So im trying the following code. The idea is just to turn on a led when an external interrupt appears (which im simulating with a button fro now), and then automatically turn it off using a timer, After i press the button a few times, the led turns on but never goes off again. So i guess the timer stops working.
@alexgrauer, since you starting the timer from the ISR, you need to use counter1.startFromISR() instead of the regular start command as per the documentation.
@alexgrauer, what is the rate of zero_cross interrupts? If it is, as I assume, 50Hz, this would explain the 20ms timer. However, the software timer has a 1ms jitter, meaning it takes up to 1ms to start or stop since the minimum resolution is 1ms. It could be that the calling `counter1.startFromISR() in zero_cross() is re-triggering the timer before it gets a chance to expire. This would give the appearance that the counter is not working.