I found a library called Timer. I want to use timers for pieso. My code is:

long ids[10];
void playNote(int pin, unsigned long freq) {
  float ms = 1000/freq;
  ids[pin] = t.oscillate(pin, ms, LOW);

void stopNote(int pin) {

Here is a full code. Where is a problem? Sorry for my bad English.

closed as unclear what you're asking by gre_gor, Michel Keijzers, Enric Blanco, SDsolar, per1234 Jul 25 '17 at 7:06

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • Why not just use the tone() function? – Majenko Mar 10 '17 at 11:50
  • @Majenko because i need to beep with many piezo – Lowder Mar 10 '17 at 11:51
  • How many? You can only do one per timer, unless you want to do fractions of a base frequency, and that gets overly complex. What are you actually trying to achieve here? – Majenko Mar 10 '17 at 11:51
  • @Majenko 10 But with that library i can do many actions. About 10 – Lowder Mar 10 '17 at 11:55
  • You can't oscillate multiple pins at multiple frequencies from a single timer. – Majenko Mar 10 '17 at 12:49