2

I need to play sound on 10 piezos at once. How to do that without delay() function.

1

Use the Timer library.

You can attach up to 10 events to each Timer object you declare. That will suit your use case.

  • Post a code please. – Lowder Mar 9 '17 at 13:33
  • Why this code not work? long ids[10]; void playNote(int pin, unsigned long freq) { int ms = 1000/freq; ids[pin] = t.oscillate(pin, ms / 2, HIGH); } void stopNote(int pin) { t.stop(ids[pin]); } – Lowder Mar 9 '17 at 13:40
  • Post a new question with your full code and not just a snippet, You'll get much better help. I'll also participate. – Enric Blanco Mar 9 '17 at 15:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.