Dust Sesnsor PMS5003
Dependencies: DustSenzor NetServices ThingSpeakEthernet mbed
Fork of PMS5003 by
main.cpp@13:5c98f1d10e70, 2017-06-13 (annotated)
- Committer:
- mpuric
- Date:
- Tue Jun 13 19:15:58 2017 +0000
- Revision:
- 13:5c98f1d10e70
- Parent:
- 12:df83e01db08e
- Child:
- 14:48368d18a793
init commit;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
segundo | 0:2419d81ee03d | 1 | #include "mbed.h" |
tsoic | 6:ebbde59c5a1d | 2 | #include "ThingSpeak.h" |
mpuric | 9:07f9279c30f7 | 3 | #include "TextLCD.h" |
mpuric | 9:07f9279c30f7 | 4 | #include "DustSenzor.h" |
mpuric | 9:07f9279c30f7 | 5 | |
segundo | 0:2419d81ee03d | 6 | |
segundo | 2:16857d9ab50d | 7 | |
segundo | 2:16857d9ab50d | 8 | |
mpuric | 9:07f9279c30f7 | 9 | ThingSpeak ts("FI2NZGSOB8LSR8YX"); |
mpuric | 9:07f9279c30f7 | 10 | DustSenzor ds(p5, p9, p10); |
segundo | 0:2419d81ee03d | 11 | |
segundo | 0:2419d81ee03d | 12 | int main() { |
mpuric | 9:07f9279c30f7 | 13 | ds.stop(); |
mpuric | 9:07f9279c30f7 | 14 | float *ptr; |
mpuric | 13:5c98f1d10e70 | 15 | float values [6]; |
mpuric | 9:07f9279c30f7 | 16 | ts.connect(); |
mpuric | 9:07f9279c30f7 | 17 | wait(1); |
mpuric | 9:07f9279c30f7 | 18 | while(1){ |
mpuric | 9:07f9279c30f7 | 19 | float res = ts.pull(282724, 1); |
mpuric | 9:07f9279c30f7 | 20 | if(res == 1){ |
mpuric | 9:07f9279c30f7 | 21 | ds.start(); |
mpuric | 9:07f9279c30f7 | 22 | } |
mpuric | 9:07f9279c30f7 | 23 | while( res == 1){ |
mpuric | 9:07f9279c30f7 | 24 | ptr = ds.read(); |
mpuric | 9:07f9279c30f7 | 25 | for( int i = 0; i < 6; i++) { |
mpuric | 13:5c98f1d10e70 | 26 | values[i] = *(ptr + i) ; |
mpuric | 13:5c98f1d10e70 | 27 | ts.setField ( values[i]*10000, i+1 ); |
mpuric | 9:07f9279c30f7 | 28 | } |
mpuric | 9:07f9279c30f7 | 29 | ts.putUp(); |
mpuric | 9:07f9279c30f7 | 30 | wait(15); |
mpuric | 9:07f9279c30f7 | 31 | res = ts.pull(282724, 1); |
mpuric | 9:07f9279c30f7 | 32 | } |
mpuric | 9:07f9279c30f7 | 33 | ds.stop(); |
mpuric | 9:07f9279c30f7 | 34 | } |
mpuric | 9:07f9279c30f7 | 35 | } |
tsoic | 6:ebbde59c5a1d | 36 |