connornishijima / arduino-volume1

Arduino tone() just got 8-bit volume control - with no extra components!

Home Page:https://hackaday.io/project/11957-8-bit-component-less-volume-control-for-arduino

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Question] noTone method

aleperno opened this issue · comments

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.

Perhaps this could be documented somewhwere in this library