Skip to content

Conversation

@bjpirt
Copy link
Contributor

@bjpirt bjpirt commented Feb 5, 2016

I needed to use tones on the ESP so I've made an implementation of this base library. Some notes:

  • it uses timer 1
  • it only currently supports one pin, though it would be quite simple to support two by using timer 0 but I haven't looked at that yet. (the standard library only supports one pin)
  • I've tested it with a logic analyser and the frequency looks good

Let me know if it looks OK to you.
Cheers,
Ben

@bjpirt bjpirt mentioned this pull request Feb 5, 2016
igrr added a commit that referenced this pull request Feb 13, 2016
Implementation of Tone library using timer1
@igrr igrr merged commit 93c446e into esp8266:master Feb 13, 2016
@pieman64
Copy link

pieman64 commented Apr 9, 2016

Is tone now included in 2.10 release?

Looking at the release it appears it is. I will try to upgrade from 2.1.0-rc2 and see how it goes.

@pieman64
Copy link

pieman64 commented Apr 9, 2016

After changing to 2.1.0 release I still don't have any sound from my 16 ohm passive buzzer.

Tried:

tone(13, 2000, 150); on WeMos D1 Mini but nothing.

The solution at #582 provides sound to the buzzer but not regular tone. Any ideas?

Is this just a WeMos issue or does tone still not work on ESP's?

@pieman64
Copy link

pieman64 commented Apr 9, 2016

OK I have tome working, in a fashion, on WeMos and regular ESP's.

tone(13, 2000, 1000) will send a tone to GPIO 13 (D7) at 2000Hz for 1 second.
Probably due to the way tone uses interrupts (just one at present I believe) I can't call tone for a second time or call noTone(13) followed by tone(13, 2000, 1000) for a second time.

Is there a work around for this so that the buzzer doesn't just play one fairly short tone but rather tone on, tone off, tone on etc?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants