SFX board serial control

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
mcschaefer
 
Posts: 4
Joined: Sat Aug 29, 2015 3:09 pm

SFX board serial control

Post by mcschaefer »

Hello,

I feel like I'm missing something basic here. I'm a little bit new to the topic of serial control.

I'm using an Adafruit SFX trigger board and an Arduino Uno.
I have everything set up as described here using software serial: https://learn.adafruit.com/adafruit-aud ... io-control

I am able to successfully use the serial monitor to trigger SFX, control volume, etc. by typing commands into the serial monitor.

What I was wondering is if it's possible to control these commands using code in an Arduino sketch rather than typing them into the serial monitor.

For example "#1\n" is what I'd type into the serial monitor to trigger SFX 1.
Can I do something similar this to trigger SFX in the same way but in my sketch instead?:

Code: Select all

if (buttonstate == 1){
Serial.write("#1\n");
}

I'm essentially trying to find a way to use code to trigger SFX or volume up/down when different events happen in my sketch (button presses etc) using serial control rather than having to digitalWrite() pins low that are connected to triggers on the SFX board, which I am currently doing.

Thanks for any help!

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: SFX board serial control

Post by adafruit_support_rick »

No, you don't want to do that. Instead, you want to call sfx.playTrack(n);, where 'n' is the track number you want to play.

Code: Select all

if (buttonstate == 1){
  sfx.playTrack(1);
}

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”