Yuliang Hao
/
Thermostat
Sample Code for RDC EET214 Lab3
Diff: main.cpp
- Revision:
- 4:c654bdf271fc
- Parent:
- 3:f2026b3d5763
--- a/main.cpp Wed Sep 27 00:08:14 2017 +0000 +++ b/main.cpp Wed Sep 27 00:14:08 2017 +0000 @@ -12,7 +12,7 @@ int display1( int iRoom_T_One); //Function to display one digits BusOut displayA(p5, p6, p7, p8, p9, p10, p11, p12); //Use P5 - P12 for Display 1 -BusOut displayB(p21,p22,p23,p24,p25,p26,p27,p28); //Use P21- P28 for display 2 +BusOut displayB(p21,p22,p23,p24,p25,p26, p27, p28); //Use P21- P28 for display 2 int main() { while(1) { @@ -29,10 +29,10 @@ display1(iRoom_T_One); //Display one digits //Turn on / off furnace according to temperature - if(iRoom_T > 27) - furnace = 0; - if(iRoom_T < 25) - furnace = 1; + if(iRoom_T > 27) //Over 27 C + furnace = 0; //Turn furnace off + if(iRoom_T < 25) //Below 25C + furnace = 1; //Turn furnace on wait(1); //Wait for 1 second } // End of while(1)