Graphic Equalizer with uLCD

Dependencies:   4DGL-uLCD-SE MSGEQ7 SDFileSystem mbed-rtos mbed wave_player

Files at this revision

API Documentation at this revision

Comitter:
amussa
Date:
Thu Mar 16 17:59:07 2017 +0000
Commit message:
Version 1

Changed in this revision

4DGL-uLCD-SE.lib Show annotated file Show diff for this revision Revisions of this file
MSGEQ7.lib Show annotated file Show diff for this revision Revisions of this file
SDFileSystem.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-rtos.lib Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
wave_player.lib Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/4DGL-uLCD-SE.lib	Thu Mar 16 17:59:07 2017 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/4180_1/code/4DGL-uLCD-SE/#2cb1845d7681
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MSGEQ7.lib	Thu Mar 16 17:59:07 2017 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/chrisisthefish/code/MSGEQ7/#974a4855a7f8
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SDFileSystem.lib	Thu Mar 16 17:59:07 2017 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/mbed_official/code/SDFileSystem/#8db0d3b02cec
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Mar 16 17:59:07 2017 +0000
@@ -0,0 +1,113 @@
+#include "mbed.h"
+#include "rtos.h"
+#include "SDFileSystem.h"
+#include "uLCD_4DGL.h"
+#include "wave_player.h"
+#include "MSGEQ7.h"
+ 
+#define MAX 700
+ 
+MSGEQ7 eq(p13, p14, p15);
+SDFileSystem sd(p5, p6, p7, p8, "sd");
+uLCD_4DGL uLCD(p9,p10,p17);
+Mutex lcd_mutex;
+AnalogOut DACout(p18);
+wave_player waver(&DACout);
+Serial pc(USBTX, USBRX);
+Mutex serialm;
+PwmOut red(p21);
+PwmOut green(p22);
+PwmOut blue(p23);
+
+
+Thread music;
+Thread image;
+Thread info;
+Thread Lighting;
+
+void music_thread(){
+    FILE *wave_file;
+    wave_file=fopen("/sd/mydir/fys.wav","r");
+    waver.play(wave_file);
+    fclose(wave_file);
+    Thread::wait(1000);
+    }
+    
+void image_thread(){
+    while(1){
+    lcd_mutex.lock();
+    uLCD.media_init();
+    uLCD.set_sector_address(0x0000, 0x001E);
+    uLCD.display_image(0,0);
+    lcd_mutex.unlock();
+    }
+    }
+
+void info_thread(){
+     while(1) {
+        eq.readInt(MAX);
+        lcd_mutex.lock();
+        for(int i = 0; i < 7; i++){
+            if (eq.freqDataInt[i] > 10){
+                uLCD.filled_circle(22+i*14, 106, 6, GREEN);
+                }
+            if (eq.freqDataInt[i] > 100){
+                uLCD.filled_circle(22+i*14, 92, 6, GREEN);
+                }
+            if (eq.freqDataInt[i] > 200){
+                uLCD.filled_circle(22+i*14, 78, 6, GREEN);
+                }
+            if (eq.freqDataInt[i] > 300){
+                uLCD.filled_circle(22+i*14, 64, 6, GREEN);
+                }
+            if (eq.freqDataInt[i] > 400){
+                uLCD.filled_circle(22+i*14, 50, 6, GREEN);
+                }
+            if (eq.freqDataInt[i] > 500){
+                uLCD.filled_circle(22+i*14, 36, 6, GREEN);
+                }
+            if (eq.freqDataInt[i] > 600){
+                uLCD.filled_circle(22+i*14, 22, 6, GREEN);
+                }
+            }
+        lcd_mutex.unlock();
+    }
+}
+     
+void lighting_thread(){
+          while(1){
+            red = 0.5;
+            green = 0;
+            blue = 0;
+            Thread::wait(638.297872);
+            red = 0;
+            green = 0.5;
+            blue = 0;
+            Thread::wait(638.297872);
+            red = 0;
+            green = 0;
+            blue = 0.5;
+            Thread::wait(638.297872);
+            red = 0.5;
+            green = 0.5;
+            blue = 0;
+            Thread::wait(638.297872);
+            red = 0.5;
+            blue = 0;
+            green = 0.5;
+            Thread::wait(638.297872);
+            red = 0;
+            blue = 0.5;
+            green = 0.5;
+            Thread::wait(638.297872);
+           }
+    }
+
+    
+
+int main() {
+        music.start(music_thread);
+        image.start(image_thread);
+        info.start(info_thread);
+        Lighting.start(lighting_thread);
+    }
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-rtos.lib	Thu Mar 16 17:59:07 2017 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/mbed_official/code/mbed-rtos/#58563e6cba1e
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Mar 16 17:59:07 2017 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/ef9c61f8c49f
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/wave_player.lib	Thu Mar 16 17:59:07 2017 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/sravet/code/wave_player/#acc3e18e77ad