SparkFun Forums 

Where electronics enthusiasts find answers.

Have questions about a SparkFun product or board? This is the place to be.
By James_Aurelius
#198785
Hello I have used the Wav Trigger board successfully with past projects that use physical switches to activate the 16 available triggers on the board. I've been impressed with its ease of use and programming using the utility. I also have had success using an Arduino Mega for other prototyping projects. I'm no expert but getting better with each project.

Now I need to control the Wav Trigger using serial Tx from my Arduino Mega for the first time. The reason is this project has too many banks of switches and the cabling will get unruly unless I simplify. i also understand that serial control would allow me to utilize all 999 sounds on the Wav Trigger memory - and I need more than the physical 16 triggers Availabke. I believe serial control will accomplish this. However I've never used serial tx rx in an arduino project.

I would love if someone knew of an on point resourcd or could provide an example sketch of how to control the Wav Trigger with serial commands. General serial tutorials are not helping me move this along.

Specific to this project i want one rocker switch when flipped to send voltage to an input pin on the Arduino (i already have this wired). Then when the input pin detects high, to have the Arduino transmit a serial command to the Wav Trigger for a particular sound to play. Thats it. Super simple to get my feet wet.

Can someone help? I hope so. Thanks!

James
By James_Aurelius
#198793
Thanks for your quick help Dan. Yep. I've seen those. They are helpful. They utilize a different board (uno) and as such the tutorial focuses on issues not specific to my board (mega) or issue. Serial tutorials on the uno mainly are about turning an out pin into a serial output. The mega has pins that are already dedicated to the task. I appreciate your help - and am still hoping to get other perspectives. I think my question would be easy for a fellow programmer - as opposed to on!one articles which never seem to really on point. Thanks again.
User avatar
By exeng
#198795
On the Mega I use AltSoftSerial to control the WAV Trigger serially as follows...
#include <AltSoftSerial.h>
// AltSoftSerial uses Arduino Mega 2560 pins 48 RX and 46 TX connected the the WAV Trigger TX and RX respectively.

Not sure what else you are looking for exactly beyond the example sketch for serial control that is provided with the WAV Trigger. Perhaps you could provide more insight as to what your sketch needs to do and how a user would control it, and what's missing for you.
#198799
I'm also not sure what you are after.
This note says:
If you’d rather use a hardware serial port (UART) instead, the library now also supports Serial, Serial1, Serial2 or Serial3. The caveat is that you have to make one small edit in the wavTrigger.h file. See the library readme file for the details of how to do this.
The rest of the tutorial provides all the information you could possibly need including what libraries you need and how each one is utilized.

This GitHub page:
https://github.com/robertsonics/WAV-Tri ... al-Library
describes each function in the Wave Trigger Arduino Serial Library.
By James_Aurelius
#199027
Thank you everyone. I read and applied your advice and tutorials. Many tutorials refer to the Uno which has limited/no serial ports other than the USB and requires serial libraries. I altered my sketch to accommodate - but alas could not get my Arduino Mega to control the Wav Trigger via serial port 3. For example resources explain the Mega does not need alt.Serial library, only that port 3 be initialized. All of it makes sense and I believe I followed along well.

Right now I am working on a from scratch prop build which has vintage single pole single throw rocker switches from the 60s. I need to get more functionality from these old switches and controlling the sound portion by serial would get the job done. Also, between the number of switches, sound triggers and LEDs, I may run out of Arduino pins!?!?

The sound trigger events are very basic. For example when switch 1 reads high, play sound 1, then when switch 1 reads low play sound 2. When switch 4 reads high play sound 4 and blink LED A for 5 seconds. Not tough - but I can't get it to work.

I know it's uncouth in forums to ask for sample code/sketches but I would appreciate any help with even just the setup of the Mega / wav trigger serial sketch. Even if one could show sample code specific to the Mega which just gets even one switch to trigger one sound by serial command I'd appreciate it.

Any and all help is appreciated.

-James.