Comments (3)
Hi @Snooze4 , if you are using Arduino to program the esp32, there should not be a problem.
It's highly unlikely that it is a library problem, unless you installed some library that changed the default behaviour of tone().
Anyways, you should not need any library to run this code. It only depends on standard arduino functions.
Please check that you are using the correct pin and also that the pin you are using can be used for this purpose. You can change the pin number in the code, please have a look.
Also, I don't have an Esp32, so i can not confirm it works. I don't see why it should not though.
from arduino-songs.
Well esp32 does not understand tone.
from arduino-songs.
Sorry for my late help.
But I think it will maybe help others.
It works on ESP32 with a little library and modifications.
(https://github.com/lbernstone/Tone32)
In the example you see how to use it, but for now.
Add this on top of the code:
// The tone library for ESP32
#include <Tone32.h>
// we use the PWM channel 0 for here
int buzzerChannel = 0;
Change this:
tone(buzzer, pgm_read_word_near(melody+thisNote), noteDuration * 0.9);
To this:
tone(buzzer, pgm_read_word_near(melody+thisNote), noteDuration * 0.9, buzzerChannel);
From this:
} else if (divider < 0) {
// dotted notes are represented with negative durations!!
noteDuration = (wholenote) / abs(divider);
noteDuration *= 1.5; // increases the duration in half for dotted notes
}
To this
else if (divider < 0) {
// dotted notes are represented with negative durations!!
noteDuration = (wholenote) / abs(divider);
noteDuration = noteDuration * 1.5; // increases the duration in half for dotted notes
}
And also this:
noTone(buzzer);
To this:
noTone(buzzer, buzzerChannel);
That's it.
from arduino-songs.
Related Issues (20)
- Any possibility to turn speak off during rest notes
- can you do among us drip
- How can I contribute to this repo?
- Please do Jurassic Park theme.
- Tetris is wrong
- add im blue HOT 1
- Created Arduino-Music library based off your examples.
- Add Megalovania(Undertale theme) *Look in comment for code*
- Could you make reach for the stars? (The one from sonic colors)
- podrian hacer una de caballeros del zodiaco la saga de ades?
- add another song :) HOT 3
- Buttons don't work while buzzer is playing HOT 3
- This nice music on ESP32
- The Godfather theme not according to sheet. Wrong note. HOT 1
- Songs are unlicensed
- Generator for songs
- Non-Blocking Code HOT 1
- Can you add Transformers G1 transition sound effect please i need it for a project HOT 1
- could you please code Treachery by Shiro Sagisu?
- can you make jurassic park theme please?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from arduino-songs.