Final Version
Dependencies: C12832 LM75B PWM_Tone_Library mbed Grove_Air_Quality_Sensor_Library
Revision 8:458213f22315, committed 2018-01-02
- Comitter:
- ko16aam
- Date:
- Tue Jan 02 16:12:44 2018 +0000
- Parent:
- 7:9f4b7b55f902
- Commit message:
- Placement;
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 9f4b7b55f902 -r 458213f22315 main.cpp --- a/main.cpp Wed Apr 19 09:10:58 2017 +0000 +++ b/main.cpp Tue Jan 02 16:12:44 2018 +0000 @@ -2,9 +2,8 @@ #include "pwm_tone.h" #include "C12832.h" -// Serial xbee1(p9, p10); //Creates a variable for serial comunication through pin 9 and 10 +// Serial xbee1(p9, p10); //Creates a variable for serial communication through pin 9 and 10 Serial pc(USBTX, USBRX);//Opens up serial communication through the USB port via the computer -PwmOut Buzzer(D5); C12832 lcd (p5, p7, p6, p8, p11); AnalogIn air(p20); AnalogIn sensor(p17); @@ -12,42 +11,24 @@ PwmOut r (p23); // red light PwmOut g (p24); // green light PwmOut b (p25); // blue light - PwmOut Ctrl1(p21); //relay PwmOut Ctrl2(p22); //relay - BusOut leds(LED1); // blue LED1 when air quality is low - - - BusIn Up(p15); BusIn Down(p12); BusIn Left(p13); BusIn Right(p16); - float airValue; -float multiplier = 50; // this number got me closest to the reading on my multimeter temp probe +float multiplier = 50; // this number got us closest to the reading on the multimeter temp probe float temp; // calculated temperature int count; // for computing average reading float total; float average; float max = 22; float min = 20; -// int Boiler_max = min + 2; void initialize(); -void buzz() - - - { - for (float i=2000.0; i<7000.0; i+=1000) { - spkr.period(0.5/i); - spkr=0.1; - wait(0.1); - } - spkr=0.0; -} int main() @@ -58,14 +39,7 @@ r = 1; b = 1; g = 1; - buzz(); - - - - - - - + while (1) { @@ -77,11 +51,6 @@ average = total / count; - - - - // min = min * 1; - if (Up) { @@ -117,7 +86,6 @@ // value 0 - max // value 1 - zero // so values closer to zero 0 brighter than closer to 1 - // buzz(); } else @@ -154,9 +122,6 @@ } - - - lcd.cls(); lcd.locate(0,0); @@ -175,9 +140,6 @@ pc.printf("min= %6.0f max= %6.0f \n \r", min, max); pc.printf("Air Quality %f \n \r",airValue); pc.printf(" \n\r"); - - - }