Go Down

Topic: Using the Tone() function (Read 1 time) previous topic - next topic

SouthernAtHeart

I am planning to use the Tone() function to give a short 5 note melody when an event is finished.  At the time I play the melody, there won't be anything else happening in my code.  But at other times my code DOES use millis() and PWM.  Are millis() and PWM only affected at the actual time I'm using the Tone() fucntion, or all the time? 


Quote
ATmega8: 2 (timers 2, and 1)
ATmega168/328: 3 (timers 2, 1, and 0)
ATmega1280: 6 (timers 2, 3, 4, 5, 1, 0)
The timer order given above is the order in which the timers are allocated. Timer 0 is a sensitive timer on the Arduino since it provides millis() and PWM functionality

Coding Badly

Quote
Is millis only affected at the actual time I'm using the Tone() fucntion, or all the time?


One timer is used for each pin that is outputting a frequency simultaneously.  If you only use one pin, only one timer is used.  In which case, millis will never be effected.

Quote
Is PWM only affected at the actual time I'm using the Tone() fucntion, or all the time?


Only while using Tone.

SouthernAtHeart

Thanks, I shouldn't have a problem, then.

Go Up