![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Dust Sesnsor PMS5003
Dependencies: DustSenzor NetServices ThingSpeakEthernet mbed
Fork of PMS5003 by
Revision 14:48368d18a793, committed 2017-06-28
- Comitter:
- mpuric
- Date:
- Wed Jun 28 18:36:09 2017 +0000
- Parent:
- 13:5c98f1d10e70
- Commit message:
- added api doc
Changed in this revision
--- a/DustSenzor.lib Tue Jun 13 19:15:58 2017 +0000 +++ b/DustSenzor.lib Wed Jun 28 18:36:09 2017 +0000 @@ -1,1 +1,1 @@ -https://developer.mbed.org/users/mpuric/code/DustSenzor/#067de0268900 +https://developer.mbed.org/users/mpuric/code/DustSenzor/#d846eb9ef8e6
--- a/ThingSpeak.lib Tue Jun 13 19:15:58 2017 +0000 +++ b/ThingSpeak.lib Wed Jun 28 18:36:09 2017 +0000 @@ -1,1 +1,1 @@ -https://developer.mbed.org/users/mpuric/code/ThingSpeakEthernet/#ea7f0ef29ef5 +https://developer.mbed.org/users/mpuric/code/ThingSpeakEthernet/#5191c0e163d6
--- a/main.cpp Tue Jun 13 19:15:58 2017 +0000 +++ b/main.cpp Wed Jun 28 18:36:09 2017 +0000 @@ -3,16 +3,14 @@ #include "TextLCD.h" #include "DustSenzor.h" - - - ThingSpeak ts("FI2NZGSOB8LSR8YX"); -DustSenzor ds(p5, p9, p10); +DustSenzor ds(p5, p9, p10); // set pin, uartTx pin, Rx pin +float value[6]; +float finValue[3]; +TextLCD_I2C lcd(&i2c_lcd, 0x7E, TextLCD::LCD16x2); int main() { - ds.stop(); float *ptr; - float values [6]; ts.connect(); wait(1); while(1){ @@ -22,15 +20,22 @@ } while( res == 1){ ptr = ds.read(); - for( int i = 0; i < 6; i++) { - values[i] = *(ptr + i) ; - ts.setField ( values[i]*10000, i+1 ); - } + + for( int i = 0; i < 6; i++) + value[i] = *(ptr + i); + + finValue[0] = ( value[0] - value[2] ); // 0.3 - 1 um / m3 + finValue[1] = ( value[2] - value[4] ); // 1 - 5 um / m3 + finValue[2] = ( value[4] - value[5] ); // 5 - 10 um / m3 + + for ( int j = 0; j < 3; j++ ) + ts.setField( finValue[j], j+1); + ts.putUp(); wait(15); res = ts.pull(282724, 1); } - ds.stop(); + ds.stop(); } }