help :(

Dependencies:   FFT

Revision:
0:d6c9b09b4042
Child:
1:5dd6801bb0d6
diff -r 000000000000 -r d6c9b09b4042 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Dec 02 18:02:03 2020 +0000
@@ -0,0 +1,71 @@
+#include "mbed.h"
+#include "SDFileSystem.h"
+#include "wave_player.h"
+#include "Adafruit_LEDBackpack.h"
+#include "Adafruit_GFX.h"
+#include "rtos.h"
+#include "FFT.h"
+
+SDFileSystem sd(p5, p6, p7, p8, "sd"); // SD card
+
+I2C i2c(p28, p27); // LED display 
+Adafruit_8x8matrix matrix = Adafruit_8x8matrix(&i2c);
+
+AnalogOut DACout(p18); // speaker
+wave_player waver(&DACout);
+Mutex speaker_lock;
+
+DigitalOut myled(LED1); // mbed LED
+
+void fft_calc_thread(void const* args) {
+    //something
+    //pull the array off of sd card
+    //vTealfft(arr, 1024);
+    while(1) {
+        myled = 1;
+        wait(0.2);
+        myled = 0;
+        wait(0.2);
+    }
+}
+
+void speaker_thread(void const* args)
+{
+    while(1)
+    {
+        // grab file here and put together string
+        // string song_title = "/sd/" + "" + ".wav";
+        
+        FILE *wave_file;
+        wave_file=fopen("/sd/africa-toto.wav","r");
+        
+        speaker_lock.lock();
+        waver.play(wave_file);
+        speaker_lock.unlock();
+        fclose(wave_file);
+        Thread::wait(100);
+        
+    }
+}
+    
+
+int main()
+{
+   
+    Thread th1(speaker_thread);
+    Thread th2(fft_calc_thread);
+    
+    matrix.begin(0x70);
+    while(1) {
+        for (int i = 0; i < 8; i++) {
+          for (int j = 0; j < 8; j++) {
+              matrix.clear();
+              matrix.drawPixel(i, j, LED_ON);
+              matrix.writeDisplay();  
+              wait(.5);
+          }
+        }
+        Thread::wait(100);
+    }
+    
+}
\ No newline at end of file