I apologize for being lazy and asking the question, except I feel overwhelmed by the amount of information I look up on my own and become confused.
I’m playing melodies and sound effects using TONE function in my application as a feedback to events togged by push-buttons. Part of my application takes a reading from a car’s tachometer rpm wire to calculate rpm’s. I attach an interrupt from tachometer opto-isolated signal, to arduino pin. To calculate math on RPM’S I use the number of pulses with the amount of time (using millis() function).
I haven’t fully reverse engineered the tone function, so I don’t know if it might hit a certain frequency, use tone on different pins, or any other conditions that might trigger the internal clock/timers to change and offset the math in the millis() functions.
millis() runs continuously in the background and tone() works in the background too.
The accuracy of millis() shouldn't be affected but I'm not certain that the resolution won't be affected because you are not reading millis() continuously and it depends on where in the loop you read it.
For example, if you add an if-statement in the loop to check something before activating/changing the tone, those instructions are going to take some time and you be reading millis() as often.
I am trying to make a project which requires a sound wave greater than 28kHz, can such a sound wave be created using arduino uno, also can u tell me the program to do so?
Gautham12: The timer setup is pretty complicated, I'm still learning myself. I think your question could probably be better suited as a new post on the section of the forum, where there may many other people scanning to help answer questions - instead of this post, which is on a different topic.