Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed wave_player mbed-rtos C12832_lcd 4DGL-uLCD-SE LCD_fonts SDFileSystem
Revision 4:59b73f321c0e, committed 2019-12-04
- Comitter:
- ShelbyC22
- Date:
- Wed Dec 04 19:44:53 2019 +0000
- Parent:
- 3:431877852f14
- Child:
- 5:b2cf15651d4e
- Commit message:
- Updated with song playing switch statement and changed menu with song names
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Wed Dec 04 18:09:19 2019 +0000
+++ b/main.cpp Wed Dec 04 19:44:53 2019 +0000
@@ -75,7 +75,7 @@
//classes could be moved to include file
//Setup RGB led using PWM pins and class
-RGBLed myRGBled(p23,p22,p21); //RGB PWM pins
+RGBLed myRGBled(p24,p23,p22); //RGB PWM pins
const LEDColor red(1.0,0.0,0.0);
const LEDColor green(0.0,0.2,0.0);
//brighter green LED is scaled down to same as red and
@@ -119,14 +119,15 @@
uLCD.printf("Pick a song");
uLCD.text_height(1.9);
uLCD.text_width(1.9);
- uLCD.locate(1,2);
- uLCD.printf("Song1");
- uLCD.locate(1,4);
- uLCD.printf("Song2");
- uLCD.locate(1,6);
- uLCD.printf("Song3");
- uLCD.locate(1,8);
- uLCD.printf("Song4");
+ //shifted over from 1 to 3 in x to make room for bubble
+ uLCD.locate(3,2);
+ uLCD.printf("Fireflies");
+ uLCD.locate(3,4);
+ uLCD.printf("The Middle");
+ uLCD.locate(3,6);
+ uLCD.printf("Stacy's Mom");
+ uLCD.locate(3,8);
+ uLCD.printf("I Write Sins Not Tragedies");
uLCD.rectangle(5, songnum*16-2, 100, songnum*16+8 ,GREEN);
lcd_mutex.unlock();
@@ -458,11 +459,44 @@
lcd_mutex.unlock();
//add case statement based on songnum or something
//code for playing song from sd
- //FILE *wave_file;
- //wave_file=fopen("/sd/sample1.wav","r");
- //waver.play(wave_file);
- //fclose(wave_file);
- //end
+ switch (songnum)
+ {
+ case 1:
+ {
+ FILE *wave_file;
+ wave_file =fopen("/sd/4180 final project/Fireflies.wav", "r");
+ waver.play(wave_file);
+ fclose(wave_file);
+ break;
+ }
+ case 2:
+ {
+ FILE *wave_file;
+ wave_file =fopen("/sd/4180 final project/The_Middle.wav", "r");
+ waver.play(wave_file);
+ fclose(wave_file);
+ break;
+ }
+ case 3:
+ {
+ FILE *wave_file;
+ wave_file =fopen("/sd/4180 final project/Stacy's_Mom.wav", "r");
+ waver.play(wave_file);
+ fclose(wave_file);
+ break;
+ }
+ case 4:
+ {
+ FILE *wave_file;
+ wave_file =fopen("/sd/4180 final project/Sins_!_Tragedies.wav", "r");
+ waver.play(wave_file);
+ fclose(wave_file);
+ break;
+ }
+ default:
+ break;
+ }
+
}
Thread::wait(100);
}
