Created
September 26, 2017 21:47
-
-
Save Skwerl/ecc12d062c4bb9f95c2a25b64e707be6 to your computer and use it in GitHub Desktop.
This file contains 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
// define variables | |
#define mp3RxPin 2 | |
#define mp3TxPin 3 | |
int volume = 255; | |
int mp3Byte = 0; | |
SoftwareSerial mp3Trigger = SoftwareSerial(mp3RxPin, mp3TxPin); | |
mp3Trigger.begin(38400); | |
// set volume | |
byte volbyte = map((volume-255), 0, 1023, 0, 255); | |
mp3Trigger.write('v'); | |
mp3Trigger.write(volbyte); | |
//play some sounds | |
mp3Trigger.write('t'); | |
mp3Trigger.write(1); | |
// stop a sound | |
mp3Trigger.write('O'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment