Skip to content

Instantly share code, notes, and snippets.

@Robotonics
Created April 26, 2013 00:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Robotonics/5464188 to your computer and use it in GitHub Desktop.
Save Robotonics/5464188 to your computer and use it in GitHub Desktop.
#include <glcd.h>
#include <glcd_Buildinfo.h>
#include <glcd_Config.h>
#include <fonts/allFonts.h>
#include <Wtv020sd16p.h>
int resetPin=2;
int clockPin = 12;
int dataPin = 13;
int busyPin = 3;
char track;
Wtv020sd16p wtv020sd16p (resetPin, clockPin, dataPin, busyPin);
void setup( ){
GLCD.Init( );
GLCD.ClearScreen( );
print_title();
GLCD.SelectFont(System5x7);
Serial.begin(9600);
}
void loop (){
if (Serial.available ( ) > 0 ){
track=Serial.read ( );
switch (track){
case '1':
wtv020sd16p.stopVoice ( );
print_track ( );
wtv020sd16p.playVoice (1);
break;
case'2':
wtv020sd16p.stopVoice( );
print_track ( );
wtv020sd16p.playVoice (2);
break;
case '3':
wtv020sd16p.stopVoice ( );
print_track ( );
wtv020sd16p.playVoice (3);
break;
case '4':
wtv020sd16p.stopVoice ( );
print_track ( );
wtv020sd16p.playVoice (4);
break;
case '5':
wtv020sd16p.stopVoice ( );
print_track ( );
wtv020sd16p.playVoice (5);
break;
}
}
}
void print_track( ){
gText Track;
Track.DefineArea(1,2,1,16);
Track.SelectFont(System5x7);
Track.CursorTo(2,2);
Track.print("Playing Track");
Track.print(track);
return;
}
void print_title ( ){
gText Title;
Title.DefineArea (1, 0, 1, 19);
Title.SelectFont (System5x7);
Title.CursorTo (1, 0);
Title.print ("Alison's MP3 player");
}
void print_status ( ) {
gText Status;
Status.DefineArea ( 3,6,1,15 );
Status.SelectFont (System5x7 );
Status.CursorTo ( 3,6 );
if ( track =='6'){
Status.print ( "Playback Paused " );
}
else if ( track =='7'){
Status.print ( " Audio Muted " );
}
else if ( track =='8'){
Status.print ( " Audio Unmuted " );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment