Simple fish eat program

Dependencies:   mbed mbed-rtos N5110 ShiftReg Tone

Revision:
3:8c9c9794bcf2
Parent:
2:532b0225519f
Child:
4:db929dab4f13
--- a/main.cpp	Mon Mar 22 15:54:04 2021 +0000
+++ b/main.cpp	Wed Mar 24 15:32:13 2021 +0000
@@ -1,20 +1,37 @@
 #include "mbed.h"
+#include "rtos.h" //allows multiple threads to run at the same time: https://os.mbed.com/handbook/RTOS
+
 #include "FishEngine.h"
+#include "Sound.h"
 
-// Attach
+/*TO DO:
+* correct the last note duration of mainTheme
+* REMEMBER TO USE VERSION CONTROL */
+
+//Attach
 N5110 lcd(p8,p9,p10,p11,p13,p21);
 Joystick joystick(p20, p19);
 Tone dac(p18);
 
 //Objects
 FishEngine fish;
+Sound sound;
+Thread thread;
+
+//initialise
+void themeThread();
 
 int main(){
     fish.system_init(lcd,dac,joystick); //initialise board
+    thread.start(themeThread);
     
     while(1){
         fish.titleSequence(lcd); //calls title sequence
         fish.mainMenu(lcd, dac, joystick);
-        wait_ms(1000);
     }
+}
+
+void themeThread(){
+    sound.mainTheme(dac);
+    wait_ms(100);
 }
\ No newline at end of file