4180 Final
Dependencies: mbed wave_player mbed-rtos 4180Final SDFileSystem
Diff: main.cpp
- Revision:
- 9:c40418c26c04
- Parent:
- 5:1e8b48d6682b
- Child:
- 10:45c62daf34d4
--- a/main.cpp Mon Apr 27 20:35:13 2020 +0000 +++ b/main.cpp Wed Apr 29 01:31:35 2020 +0000 @@ -11,44 +11,10 @@ #include "fireflies.h" #include "wave_player.h" #include "rtos.h" - -Nav_Switch myNav(p9, p6, p7, p5, p8); //pin order on Sparkfun breakout -uLCD_4DGL uLCD(p28, p27, p30); // serial tx, serial rx, reset pin; -PwmOut myled(LED1); -SDFileSystem sd(p11, p12, p13, p10, "sd"); -microphone mymic1(p15); -AnalogIn pot(p16); -AnalogOut DACout(p18); -DigitalOut led(LED2); -PwmOut myled3(LED3); - -Thread thread1, thread2; - -// Stuff for sound -unsigned char *music = NULL; -wave_player waver(&DACout); -Ticker nextsample; -volatile int sIndx = 0; -int playMusic = 0; - -// Globals -int rounds = 3; -int curRound = 1; -int score1 = 0; -int score2 = 0; -int scores1[7] = {0}; -int scores2[7] = {0}; -int curTime = 0; -int wonRnds1 = 0; -int wonRnds2 = 0; -int highScoresArr[10] = {100, 90, 83, 73, 64, 54, 44, 34, 24, 14}; -int s = 0; -int timer = 0; -volatile int micScore = 0; +#include "play.h" +#include "init.h" int main(); -void play(); - // Method for ticker for sound void playMenuMusic() { @@ -362,7 +328,7 @@ return 10; //int(mymic1*1000.0); } -void play() { +void play_old() { uLCD.background_color(GREEN); uLCD.cls(); uLCD.filled_rectangle(0, 0, 200, 15, RED); @@ -562,6 +528,7 @@ int main() { // read in highScoresArr from SD card + /* FILE *fp = fopen("/sd/finalProj/highscores.txt", "r"); if(fp == NULL) { uLCD.printf("Error Open \n"); @@ -570,6 +537,7 @@ fscanf(fp, "%4d", &highScoresArr[i]); } fclose(fp); + */ // create menu interface uLCD.background_color(LBLUE); uLCD.cls();