![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Dust Sesnsor PMS5003
Dependencies: DustSenzor NetServices ThingSpeakEthernet mbed
Fork of PMS5003 by
Diff: main.cpp
- Revision:
- 9:07f9279c30f7
- Parent:
- 7:1da0a084cd69
- Child:
- 12:df83e01db08e
--- a/main.cpp Sun Nov 29 14:26:32 2015 +0000 +++ b/main.cpp Mon Jun 05 08:12:57 2017 +0000 @@ -1,53 +1,49 @@ #include "mbed.h" -#include "iostream" #include "ThingSpeak.h" -#include "Sensor.h" -#include "C12832.h" -#include "INA219.h" +#include "TextLCD.h" +#include "DustSenzor.h" + - ThingSpeak ts("074MPWFODR7JHD1K"); - C12832 lcd(p5, p7, p6, p8, p11); - Sensor current(p19,4.65); - Sensor voltage(p20,16.23); - - +ThingSpeak ts("FI2NZGSOB8LSR8YX"); +DustSenzor ds(p5, p9, p10); int main() { - INA219 ina219; - float U, I, ina[3]; - int i; - - lcd.cls(); - lcd.locate(0,3); - lcd.printf("Ethernet Connecting ! \n"); - ts.connect(); - lcd.printf("Ethernet Connected ! \n"); - wait(1); + ds.stop(); + float *ptr; - while(1){ - - U = voltage.read(); - I = current.read(); - ina[0] = ina219.readRawReg(0x04);//* Current *// - ina[1] = ina219.readRawReg(0x02); //* Bus Voltage *// - ina[2] = ina219.readRawReg(0x03);//* Power *// - - lcd.cls(); - lcd.locate(0,3); - lcd.printf("V = %.2f V \n",ina[1]); - lcd.printf("I = %.2f A \n",ina[0]); - lcd.printf("P = %.2f W \n",ina[2]); + ts.connect(); + wait(1); + while(1){ + float res = ts.pull(282724, 1); + if(res == 1){ + ds.start(); + } + while( res == 1){ + ptr = ds.read(); + for( int i = 0; i < 6; i++) { + ts.setField(*(ptr + i), i+1); + } + ts.putUp(); + wait(15); + res = ts.pull(282724, 1); + } + ds.stop(); + } +} - i = 1; - ts.setField(U, i++); - ts.setField(I, i++); - ts.setField(I*U, i++); - for(int j = 0 ; j<= 2; j++) - ts.setField(ina[j], i++); - - ts.putUp(); - wait(15); - } -} \ No newline at end of file + + +/* void DustSenzor::modeSet(){ + if(debounce.read_ms() > 250 && provjera==false) { + set=1; + debounce.reset(); + provjera=true; + } + else if(debounce.read_ms() > 250 && provjera==true){ + set=0; + debounce.reset(); + provjera=false; + } + } */ \ No newline at end of file