Hello everyone,
i'm a new subscriber and i'd like to have some information about the timers in ARDUINO MEGA.
I have ARDUINO MEGA ADK and i know that the pin 10 is linked to the timer2 of the microprocessor.
I can use the timer2 to generate a PWM signal with a specific frequency, for example i'm using this code:
pinMode(10, OUTPUT);
TCCR2A = _BV(COM2A0) | _BV(COM2B1) | _BV(WGM21) | _BV(WGM20);
TCCR2B = _BV(WGM22) | _BV(CS00);
OCR2A = 200;
OCR2B = 50;
Now i can generate a PWM pulse from pin10 with a specific frequency (40 kHz) and a specific duty cicle which will go during all the loop subfunction (so it will never stop).
The question is: can i turn off the PWM pulse after i have generate it?
I can't find any function that could disable the timer2, i know that i can set pin10 as INPUT in order to stop the PWM signal but for my project i need to maintain the pin10 as output.
Can you help me?
Thanks everyone.