How do I code a Button That is Wired to the Arduino though the bread board to play a sound file sound file is named Trumpet.Mp3
buttons can't play sound...
Step one is to understand the basics of hardware and software.
You need an Add-on board.
The Arduino by itself can generate square wave "tones" but the "basic" Arduino doesn't have a DAC (no true-analog output), it doesn't have enough memory for an MP3 file, and it's not powerful enough to decode an MP3.
You might also have to re-name the file. The Arduino doesn't have an operating system, so no built-in file system for reading/writing files. That would depend on the add-on board and most of them I've seen need files named file1.MP3 and file3.MP3, or something standardized like that.
The Button would be connected to the arduino
Like this?
It still can’t play music…
How do you plan to play the file? Where is it stored ? What’s your sound playing device?i
the file is going to be located on a ds player and a speaker will be hooked up to it
DFPlayer ?
Yes
so did you look at the library and all the examples ?
Yes, It was not so useful.
Start with the Arduino State Change Detection example, and learn how to use a button to turn on and off an LED. Files > Examples > 02.Digital > StateChangeDetection
Then exchange the LED action with the player action.
I trust you prefer to manage your own handling of the Serial protocol then…. But given your apparent knowledge of the platform and electronics / C++ I really do think the library will make your life easier - as would a button library too such as Button in easyRun, OneButton or Toggle
show the button picture
https://www.amazon.com/mxuteuk-Self-Lock-Flashlight-Latching-BK-1208/dp/B086L1WKS3/ref=sr_1_6?crid=6HROAPKJZWZ9&keywords=Micro%2BBit%2BButtons&qid=1677693713&sprefix=micro%2Bbit%2Bbttons%2Caps%2C641&sr=8-6&th=1
These buttons you have to place on a breadboard so im trying to figure out how to code it.
There are countless tutorials on buttons and arduino
Did you read any?
Oh thank you guys so much this is exactly what i'm trying to do so thank you guys so much.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.