Go Down

Topic: Tone library using 16 bit timer (Read 1 time) previous topic - next topic


Ive seen this subject in other threads but not the explanation or how to
(sorry still learning!)

so I want to use the tone library to generate tones from 1 hz,
I saw that the 16 bit timer needs to be used,
so how to I have to change to accomplish this?

thank you


I second this question. I have been looking to do the exact same thing.


Oct 21, 2010, 09:56 pm Last Edit: Oct 21, 2010, 10:01 pm by mako34 Reason: 1
hi, thank you to mr Brett Hagman of Rogue Robotics
for the library and the explanation,
tone library:

I have put togher this code, to generate 1Hz, 10 Hz, and 50Hz as test,
Code: [Select]

#include <Tone.h>

Tone freq1;
Tone freq2;

void setup()

void loop()
 freq2.play(1, 6000);
 delay (2000);
 freq2.play(10, 6000);
 delay (2000);
 freq2.play(50, 6000);
 delay (2000);

the freq2 is the timer of 16 bits
" The timers are allocated sequentially when you declare the Tone objects.  The second timer is Timer 1, which is a 16 bit timer."

Ok, very nice, thank you again Brett for the library and the explanation,
now to do my project !!! hahaha  :D


Thank you very much for the reply! This had been driving me nuts trying to figure out how to use Timer1.

I had also PM'd Brett, but I guess he got back to you first :D

Can I assume that only Timer1 is 16bit? For my project, I actually need 2 outputs (to drive a speedometer and a tachometer, both requiring a square wave with a frequency range of 0 to ~230 hz).

Thanks again!

Go Up