Joseph Boettcher / Mbed 2 deprecated ECE4180_Lab3_Threads_Updated

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

Fork of ECE4180_Lab3_Threads_Updated by Sean Buckingham

Revision:
9:b49b975d102f
Parent:
8:17ac4f255e4b
Child:
10:f916ef16eb62
--- a/main.cpp	Mon Oct 03 21:12:00 2016 +0000
+++ b/main.cpp	Tue Oct 04 23:53:35 2016 +0000
@@ -5,9 +5,9 @@
 #include "wave_player.h"
 
 /* shiftbright instantiation*/
-DigitalOut red(p23);
-DigitalOut blue(p21);
-DigitalOut green(p22);
+PwmOut red(p21);
+PwmOut blue(p23);
+PwmOut green(p22);
 
 /*uLCD instantiation*/
 uLCD_4DGL uLCD(p9,p10,p11); // serial tx, serial rx, reset pin;
@@ -24,11 +24,19 @@
 
 /* makes different colored squares the same color as the shiftbright*/
 void lcd_thread1(void const *args) {
+    int dist = 40;
     while (true) {
-        if (green == 1) {
+        if (red != 0) {
         mutex.lock();
         //uLCD.cls();
-        uLCD.filled_rectangle(64-25, 64-25, 64+25, 64+25, 0xff66cc);
+        //uLCD.filled_rectangle(64-25, 64-25, 64+25, 64+25, 0xff66cc);
+        uLCD.cls();
+        uLCD.locate(64,64);
+        uLCD.color(0xFFFF00); //yellow text
+        uLCD.background_color(0xFFA500); //orange
+        uLCD.filled_rectangle(64-dist, 64-dist, 64+dist, 64+dist, 0xff0000); //red square
+        uLCD.text_mode(OPAQUE);
+        uLCD.printf("Charmander!!");
         mutex.unlock();
         //Thread::wait(1000);
         }
@@ -37,28 +45,30 @@
 
 /*makes different colored circle every time the bell sound sounds*/
 void lcd_thread2(void const *args) {
+    int rad = 40;
     while (true) {
         if (blue == 1) {
         mutex.lock();
-        //uLCD.cls();0x336600
-        uLCD.filled_rectangle(64-25, 64-25, 64+25, 64+25, 0x336600);
+        uLCD.cls();
+        uLCD.locate(64,64);
+        uLCD.color(0xFFFF00); //yellow text
+        uLCD.background_color(0x0000ff); //blue background
+        uLCD.filled_circle(64, 64, rad, 0xB7D5E9); //light blue circle
+        uLCD.text_mode(OPAQUE);
+        uLCD.printf("Bulbasaur!!");
+        //uLCD.filled_rectangle(64-25, 64-25, 64+25, 64+25, 0x336600);
         mutex.unlock();
-        //Thread::wait(1000);
         }
     }
 }
 
 /*play wav file on sd and when playing led1 turns on*/
 void wav_thread3(void const *args) {
-    //led2 = 1;
     while (1) {
         FILE *wave_file;
-        wave_file=fopen("/sd/wavfiles/wreck.wav","r");
+        wave_file=fopen("/sd/wavfiles/alarm.wav","r");
         waver.play(wave_file);
-        //led1 = 1;
         fclose(wave_file);
-        //Thread::wait(1000);  
-        //led1 = 0;
     }
 }
 
@@ -70,9 +80,9 @@
     
         Thread::wait(1000);  
     
-        red = 0;
+        red = 0.8;
         blue = 0;
-        green = 1;
+        green = 0;
 
         Thread::wait(1000);   
     }