-->
Page 1 of 2

Use ESP8266 (NodeMCU or WeMos) together with tone() library

PostPosted: Wed Jan 13, 2016 5:33 pm
by Gawan
Is there a working sketch for ESP8266 and tone() ?

I tried to use a fully working sketch from my arduino uno on several ESP8266s, but there is absolute no output from the speaker :(

Re: Use ESP8266 (NodeMCU or WeMos) together with tone() libr

PostPosted: Thu Jan 14, 2016 7:39 am
by schufti

Re: Use ESP8266 (NodeMCU or WeMos) together with tone() libr

PostPosted: Thu Jan 14, 2016 8:15 am
by WereCatf
This should work, though I don't have a buzzer to test with.
Code: Select allvoid tone(uint8_t _pin, unsigned int frequency, unsigned long duration) {
pinMode (_pin, OUTPUT );
analogWriteFreq(frequency);
analogWrite(_pin,500);
delay(duration);
analogWrite(_pin,0);
}

Re: Use ESP8266 (NodeMCU or WeMos) together with tone() libr

PostPosted: Thu Jan 14, 2016 5:15 pm
by Gawan
oh yes it works ... and it was THAT easy ! :shock:

Thank you SO much !!!! :D :D