r/ArduinoHelp • • 15d ago

Beginner help needed.

I just wanted to start by saying I don't know much about Arduinos or electronic setups yet, but I'm pretty comfortable with soldering and can usually figure out the software side of things! I currently have a cosplay project and wanted to set up a custom sound box. My idea is that when I open a mask that has an articulated jaw, it releases a Mini Micro Limit Switch 3 Pins KW11-3Z07 and sends a singular signal to a DY-SV5W Voice Playback Module so the audio plays once. When I press the jaw back together, it won't do anything; it will just wait to be opened again. Is this configuration feasible? What specific components or modifications would be required, or would I need to restart the project from scratch? Please let me know. Additionally, I intend to power the setup using a standard power bank.

2 Upvotes

11 comments sorted by

View all comments

Show parent comment

1

u/mtraven23 14d ago

so somewhere in loop(), you make some function call that plays the sound, right? Probably after checking the state of that switch?

so add a flag variable, call it hasPlayed. Now you can check to see if it has played, and do nothing if it has. If it hasn't, play the sound and flip the flag to true.

now, you'll also need to track the state of the switch such that when it changes states (jaw open to jaw closed) you reset that hasPlayed variable so it will run again the next time you open it.

1

u/eriknau13 14d ago

This here is the way