adfdadf

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

Fork of rtos_mutex by mbed official

Revision:
8:ba3c6765eba3
Parent:
7:2122726e9b46
--- a/main.cpp	Fri Feb 26 18:36:22 2016 +0000
+++ b/main.cpp	Fri Feb 26 20:10:59 2016 +0000
@@ -37,17 +37,58 @@
     latch=0;
 }
 */
+void lcd1_thread(void const *args) {
+    while(1){
+        int drop = rand()% 140;
+        for(int i = 0; i < 140; i += 3){
+            stdio_mutex.lock();
+            uLCD.filled_circle(i-3,drop,5,BLACK);
+            uLCD.filled_circle(i,drop,5,BLUE);
+            stdio_mutex.unlock();
+            //Thread::wait(50);
+        }
+    }
+}
+
+void lcd2_thread(void const *args) {
+    Thread::wait(250);
+    while(1){
+        int drop = rand()% 140;
+        for(int i = 0; i < 140; i += 6){
+            stdio_mutex.lock();
+            uLCD.filled_circle(i-6,drop,5,BLACK);
+            uLCD.filled_circle(i,drop,5,BLUE);
+            stdio_mutex.unlock();
+            //Thread::wait(200);
+        }
+    }
+}
+
+void lcd3_thread(void const *args) {
+    Thread::wait(100);
+    while(1){
+        int drop = rand()% 140;
+        for(int i = 0; i < 140; i += 2){
+            stdio_mutex.lock();
+            uLCD.filled_circle(i-2,drop,5,BLACK);
+            uLCD.filled_circle(i,drop,5,BLUE);
+            stdio_mutex.unlock();
+            //Thread::wait(100);
+        }
+    }
+}
 
 void wav_thread(void const *args) {
     while(1) {
         FILE *wave_file;
-        printf("\n\n\nHello, wave world!\n");
+        printf("\n\n\nHello, wave world!\n\r");
         wave_file=fopen("/sd/beethoven.wav","r");
+        printf("hello\n\r");
         if (wave_file) {
-            printf("wave file found");
+            printf("wave file found\n\r");
             }
         else {
-            printf("file not found");
+            printf("file not found\n\r");
             }
         waver.play(wave_file);
         fclose(wave_file);
@@ -60,15 +101,10 @@
     int r,g,b;
     while(1) {
         r=g=b=50;
-        myBrite.Write(255,255,255);
-        Thread::wait(500);
-        myBrite.Write(0,0,255);
-        Thread::wait(500);
-        myBrite.Write(0,255,0);
-        Thread::wait(500);
-        myBrite.Write(255,0,0);
-        Thread::wait(500);
-        
+        myBrite.Write(250,250,160);
+        Thread::wait(150);
+        myBrite.Write(0,0,0);
+        Thread::wait(3000+(rand()%10000));
         myBrite.Brightness(r,g,b);
         if(r<1023)
             r+=50;
@@ -94,26 +130,17 @@
     stdio_mutex.unlock();
 }
 
-/*void test_thread(void const *args) {
-    while (true) {
-        notify((const char*)args, 0); Thread::wait(1000);
-        notify((const char*)args, 1); Thread::wait(1000);
-    }
-}*/
-
 int main() {
+    uLCD.baudrate(BAUD_3000000);
     Thread audio(wav_thread);
     Thread thread(led2_thread);
     Thread lighting(shift_thread);
+    Thread image1(lcd1_thread);
+    Thread image2(lcd2_thread);
+    Thread image3(lcd3_thread);
     
     while (true) {
         led1 = !led1;
         Thread::wait(500);
     }
-        
-    //Thread t2(test_thread, (void *)"Th 2");
-    //Thread t3(test_thread, (void *)"Th 3");
-    
-    //test_thread((void *)"Th 1");
-    
-}
+}
\ No newline at end of file