Updated
Dependencies: C12832 LM75B PWM_Tone_Library mbed
Fork of IoT Project Final by
Revision 3:9c4e6163a71b, committed 2017-02-22
- Comitter:
- ko16aam
- Date:
- Wed Feb 22 11:32:35 2017 +0000
- Parent:
- 2:c8d16cec2564
- Commit message:
- Code fixes and alterations
Changed in this revision
diff -r c8d16cec2564 -r 9c4e6163a71b LM75B.lib --- a/LM75B.lib Wed Feb 22 10:12:53 2017 +0000 +++ b/LM75B.lib Wed Feb 22 11:32:35 2017 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/neilt6/code/LM75B/#fc27dc535ea9 +http://mbed.org/users/neilt6/code/LM75B/#7ac462ba84ac
diff -r c8d16cec2564 -r 9c4e6163a71b PWM_Tone_Library.lib --- a/PWM_Tone_Library.lib Wed Feb 22 10:12:53 2017 +0000 +++ b/PWM_Tone_Library.lib Wed Feb 22 11:32:35 2017 +0000 @@ -1,1 +1,1 @@ -http://developer.mbed.org/users/justinkim/code/PWM_Tone_Library/#d06af372d384 +http://developer.mbed.org/users/justinkim/code/PWM_Tone_Library/#4b841d62e529
diff -r c8d16cec2564 -r 9c4e6163a71b main.cpp --- a/main.cpp Wed Feb 22 10:12:53 2017 +0000 +++ b/main.cpp Wed Feb 22 11:32:35 2017 +0000 @@ -5,7 +5,7 @@ //DigitalOut myled(LED1); PwmOut Buzzer(D5); C12832 lcd(p5, p7, p6, p8, p11); -AnalogIn sensor(p15); +AnalogIn sensor(p16); PwmOut spkr(p26); BusOut RGB (p23, p24, p25); @@ -56,13 +56,16 @@ int count; // for computing average reading float total; float average; +int MAX = 22; +int MIN = 20; +int Boiler_MAX = MIN + 2; void buzz() { - for (float i=2000.0; i<10000.0; i+=100) { - spkr.period(1.0/i); - spkr=0.5; + for (float i=2000.0; i<7000.0; i+=1000) { + spkr.period(0.5/i); + spkr=0.1; wait(0.1); } spkr=0.0; @@ -71,8 +74,8 @@ int main() { count = 0; total = 0.0; - RGB = 0xFF; - buzz(); +// RGB = 0xFF; +// buzz(); while (1) { // formula is analog reading * multiplier @@ -82,6 +85,25 @@ total += temp; average = total / count; + if(temp > MAX) + { + RGB = 0xff; + buzz(); + } + else + { + RGB = 0x19; + } + + if(temp < MIN) + { + RGB = 0x06; + } + else + { + RGB = 0x19; + } + lcd.cls(); lcd.locate(0,3); lcd.printf("Temperature= %6.2f \n Average= %5.1f \n", temp , average );