Playing sound files with magnetic sensor

Hi

Beginner. I would be really grateful if someone could paste me code for this:

I want to make a joke bin that plays a different sound effect (wav. file) upon opening the lid. The sound effects are monster growls and eating sounds, like there is a trash beast eating the rubbish.

I have 23 different sound effects (wav. files). Each sound is 5 seconds max. I have 23 sounds, as it would be boring for the same sound to play each time. So I want the 23 sound effects to play on rotation. For example, 1st lid opening - sound one only plays. 2nd lid opening - sound two only plays, 3rd lid opening - sound three only plays, etc. I don't want all 23 sounds to play at once.

I have the following components:
Magnetic reed switch to position on the bin lid.
Micro SD card shield module
CQRobot speaker - 3 Watt 8 Ohm

If you could tell me which pins to put the wires into - that would be a great help.

Thank you very much.

Hello minton

This is a nice project to get started.

Keep it simple and stupid firstly.
Run some tutorials for the hardware selected.
If you are happy with the results of the tutorials you can merge these to your project.

Have a nice day and enjoy coding in C++.

That requires an additional audio amplifier.

Have you though about an MP3 player module for the storage and play of the sound?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.