Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 0:0cefe4d28e60, committed 2019-05-27
- Comitter:
- tony63
- Date:
- Mon May 27 05:08:09 2019 +0000
- Commit message:
- MEDIDOR DE CALIDAD DEL AIRE
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/PMS1003.lib Mon May 27 05:08:09 2019 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/jonfer/code/PMS1003/#afde174c0557
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Mon May 27 05:08:09 2019 +0000
@@ -0,0 +1,33 @@
+/*******************************************************************************
+* Referencias
+* [1] https://www.dfrobot.com/wiki/index.php/PM2.5_laser_dust_sensor_SKU:SEN0177
+*******************************************************************************/
+#include "mbed.h"
+#include "pms1003.h"
+
+#define LENG 31 //0x42 + 31 bytes equal to 32 bytes
+char buf[LENG];
+
+Serial *pc = new Serial(USBTX, USBRX); // tx, rx
+Serial *device = new Serial(PTE0, PTE1); // tx, rx
+pms1003 *PM = new pms1003();
+
+int main() {
+ while(1) {
+ if(device->readable()) {//if 1
+ //pc.putc(device.getc());
+ if ( device->getc() == 0x42){//if 2
+ device->gets(buf,LENG);
+
+ if(buf[0] == 0x4d){//if 3
+
+ PM->setPM(buf);
+ pc->printf("*******************************\n");
+ pc->printf("PM_1.0:%4d [ug/m3]\n",PM->get_PM01Value());
+ pc->printf("PM_2.5:%4d [ug/m3]\n",PM->get_PM2_5Value());
+ pc->printf("PM__10:%4d [ug/m3]\n",PM->get_PM10Value());
+ }//if 3
+ }//if 2
+ }//if 1
+ }//while
+}// main
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Mon May 27 05:08:09 2019 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400 \ No newline at end of file