Using the new Arduino IDE for ESP8266 and found bugs, report them here

Moderator: igrr

User avatar
By Dave_
#73850 Hi guys.
Not sure if this is properly a bug, but I couldn't find a more appropiate section.
I'm using a NodeMcu ESP 8266 to generate tones at the pression of a button, and everything works fine; however, if I call analogWrite() on a different pin, and then set the pin to LOW before calling tone(), the buzzer won't produce any sound.
Am I doing something wrong, or is there a problem?

Here is the code snippet:
Code: Select allconst byte buzzerPin = 15; //D8
const byte ledPin = 5;

tone(buzzerPin, 440);
delay(toneDuration);
noTone(buzzerPin);

//everything works fine here

analogWrite(ledPin, 230);
//do other stuff, then...
digitalWrite(ledPin, LOW);

tone(buzzerPin, 440);
delay(toneDuration);
noTone(buzzerPin);

//the second "tone()" does not work


I think it has something to do with the usage of the same timer, but I'm not sure at all.

Thanks to all!