Last active
December 16, 2015 10:29
-
-
Save Robotonics/5420129 to your computer and use it in GitHub Desktop.
Arduino BTMP04
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 <glcd.h> | |
#include <glcd_Buildinfo.h> | |
#include <glcd_Config.h> | |
#include <fonts/allFonts.h> | |
#include <Wtv020sd16p.h> | |
int resetPin = 2; // The pin number of the reset pin. | |
int clockPin = 12; // The pin number of the clock pin. | |
int dataPin = 13; // The pin number of the data pin. | |
int busyPin = 3; // The pin number of the busy pin. | |
char track; | |
/* | |
Create an instance of the Wtv020sd16p class. | |
1st parameter: Reset pin number. | |
2nd parameter: Clock pin number. | |
3rd parameter: Data pin number. | |
4th parameter: Busy pin number. | |
*/ | |
Wtv020sd16p wtv020sd16p(resetPin,clockPin,dataPin,busyPin); | |
void setup() { | |
//Initializes the module. | |
wtv020sd16p.reset(); | |
GLCD.Init(); | |
GLCD.ClearScreen(); | |
GLCD.SelectFont(System5x7); | |
GLCD.CursorTo(1,0); | |
GLCD.print("Alison's MP3 Player"); | |
Serial.begin(9600); | |
// initialise the outputs | |
} | |
void loop(){ | |
if (Serial.available() > 0) | |
{ | |
track=Serial.read(); | |
switch (track) { | |
case '1': | |
wtv020sd16p.stopVoice(); | |
delay(50); | |
GLCD.CursorTo(2,2); | |
GLCD.print("Playing Track "); | |
GLCD.print(track); | |
wtv020sd16p.playVoice(1); | |
delay(50); | |
break; | |
case '2': | |
wtv020sd16p.stopVoice(); | |
delay(50); | |
GLCD.CursorTo(2,2); | |
GLCD.print("Playing Track "); | |
GLCD.print(track); | |
wtv020sd16p.playVoice(2); | |
delay(50); | |
break; | |
case '3': | |
wtv020sd16p.stopVoice(); | |
delay(50); | |
GLCD.CursorTo(2,2); | |
GLCD.print("Playing Track "); | |
GLCD.print(track); | |
wtv020sd16p.playVoice(3); | |
delay(50); | |
break; | |
case '4': | |
wtv020sd16p.stopVoice(); | |
delay(50); | |
GLCD.CursorTo(2,2); | |
GLCD.print("Playing Track "); | |
GLCD.print(track); | |
wtv020sd16p.playVoice(4); | |
delay(50); | |
break; | |
case '5': | |
wtv020sd16p.stopVoice(); | |
delay(50); | |
GLCD.CursorTo(2,2); | |
GLCD.print("Playing Track "); | |
GLCD.print(track); | |
wtv020sd16p.playVoice(5); | |
delay(50); | |
break; | |
case '6': | |
wtv020sd16p.pauseVoice(); | |
delay(50); | |
GLCD.CursorTo(4,6); | |
GLCD.print(" Paused "); | |
delay(50); | |
break; | |
case '7': | |
wtv020sd16p.mute(); | |
delay(50); | |
GLCD.CursorTo(4,6); | |
GLCD.print(" Muted "); | |
delay(50); | |
break; | |
case '8': | |
wtv020sd16p.unmute(); | |
delay(50); | |
GLCD.CursorTo(4,6); | |
GLCD.print(" Unmuted "); | |
delay(50); | |
break; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment