connornishijima / arduino-volume1

Arduino tone() just got 8-bit volume control - with no extra components!
https://hackaday.io/project/11957-8-bit-component-less-volume-control-for-arduino
GNU General Public License v3.0
116 stars 26 forks source link

[Question] noTone method #10

Closed aleperno closed 6 years ago

aleperno commented 6 years ago

Hi,

I'm testing this Library (actually trying to make the cricket prank) on an Arduino "Pro Micro" (Atmega 32u4)

currently using this code

void setup() {
  vol.begin();
}
void loop() {
  vol.tone(3850, 255);
  vol.delay(2500);
  vol.noTone();
  vol.delay(2500);
}

This is not generating any tone (testing both on a speaker and a led). The same code on a Arduino Mega works just fine.

Replacing vol.noTone() with a vol.fadeOut(1) does the trick and it works. I took a look at Volume.cpp and couldn't find anything that could explain this behaviour, moreover nothing that could imply the difference between the boards.

What should I be looking for in order to make noTone work properly?

Thanks in advance

[Edit]

Nevermind... a more thorough google search showed me for some boards there are issues between pwm and tone. Changing the output pin to another pwm (3 instead of 9) made it work.

heltonbiker commented 6 years ago

Perhaps this could be documented somewhwere in this library