Last active
May 31, 2017 10:27
-
-
Save garethfoote/8ab2cb28283e678b25322b8cd5ebca0c to your computer and use it in GitHub Desktop.
Using soft serial for MP3 Trigger.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <SoftwareSerial.h> | |
SoftwareSerial sSerial(10, 11); // RX, TX | |
void setup() { | |
Serial.begin(9600); | |
while (!Serial); | |
// set the data rate for the SoftwareSerial port | |
sSerial.begin(38400); | |
// Set volume | |
sSerial.print( "v" ); | |
sSerial.write( '0' ); // 0 = maximum volume, 255 = minimum volume | |
} | |
void loop() { | |
// Play track 1 | |
sSerial.write('T'); | |
sSerial.print(1); | |
delay(2000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment