Mathias Madsen
/
mbed_indeklima
asf
Fork of mbed_indeklima by
Revision 1:da3579be9a8d, committed 2014-10-28
- Comitter:
- mathiasoem
- Date:
- Tue Oct 28 09:25:20 2014 +0000
- Parent:
- 0:fb4d631a5994
- Commit message:
- fa
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r fb4d631a5994 -r da3579be9a8d main.cpp --- a/main.cpp Tue Oct 28 09:02:51 2014 +0000 +++ b/main.cpp Tue Oct 28 09:25:20 2014 +0000 @@ -2,9 +2,6 @@ #include "RHT03.h" //Include neede to use the RHT03 lib Serial pc(USBTX, USBRX); -I2C i2c(p28,p27); //sda=p28. scl=p27 - -Serial xBee(p9, p10); //xBee pins int done=0; float temp,hum; @@ -14,18 +11,6 @@ DigitalOut lysdiode(p14); void tickerFunction() { - //I2C CO2 - const char cmd[4] = {0x22,0x00,0x08,0x2A}; - i2c.write(0xD0, cmd, 4); - char data[4] = {0x00,0x00,0x00,0x00}; - wait_ms(50); - i2c.read(0xD1, data, 4); - int CO2i2c = (int)data[1]*0x100 + (int)data[2]; - - - - //Print data - pc.printf("CO2: %d\n", CO2i2c); //Hum & Temp while(!done) { //Loop keeps running until RHT03 is read succesfully @@ -37,7 +22,7 @@ temp = humtemp.getTemperatureC(); //Gets the current temperature in centigrade hum = humtemp.getHumidity(); //Gets the current humidity in percentage - if (hum > 50 || temp > 23 || CO2i2c > 1000) { + if (hum > 50 || temp > 23) { lysdiode = 0; } else { lysdiode = 1; @@ -45,7 +30,6 @@ //Print data pc.printf("Hum: %0.2f, Temp: %0.2f\n", hum, temp); - xBee.printf("xxxx;indeklima;%0.2f;%0.2f;%i\r\n", hum, temp, CO2i2c); } @@ -56,7 +40,6 @@ pc.printf("Hello\n"); - i2c.frequency(100000); //mBed default frequency = 100kHz = max frequency of CO2 sensor ticker.attach(&tickerFunction, 5.0); //update every 1 sec while (1) {