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.
Fork of frdm_https_HPM by
Main.cpp@27:373612b1cd94, 2017-12-06 (annotated)
- Committer:
- Roietronics
- Date:
- Wed Dec 06 11:25:25 2017 +0000
- Revision:
- 27:373612b1cd94
New tester HPM_lib_tester loads hang online ide
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| Roietronics | 27:373612b1cd94 | 1 | #include "mbed.h" |
| Roietronics | 27:373612b1cd94 | 2 | #include "HPM.h" |
| Roietronics | 27:373612b1cd94 | 3 | |
| Roietronics | 27:373612b1cd94 | 4 | #define TESTER_VERSION 1.0 |
| Roietronics | 27:373612b1cd94 | 5 | |
| Roietronics | 27:373612b1cd94 | 6 | Serial pc(USBTX, USBRX, 115200); |
| Roietronics | 27:373612b1cd94 | 7 | |
| Roietronics | 27:373612b1cd94 | 8 | #if MODE == 4 |
| Roietronics | 27:373612b1cd94 | 9 | RawSerial link(D0, D1); |
| Roietronics | 27:373612b1cd94 | 10 | #endif |
| Roietronics | 27:373612b1cd94 | 11 | |
| Roietronics | 27:373612b1cd94 | 12 | main() |
| Roietronics | 27:373612b1cd94 | 13 | { |
| Roietronics | 27:373612b1cd94 | 14 | pc.printf("Starting HPM library Tester Version %s\n", TESTER_VERSION); |
| Roietronics | 27:373612b1cd94 | 15 | #if MODE == 4 |
| Roietronics | 27:373612b1cd94 | 16 | HPM pm(&link); |
| Roietronics | 27:373612b1cd94 | 17 | #else |
| Roietronics | 27:373612b1cd94 | 18 | HPM pm(D1, D0); //Create an instance of a HPM class object |
| Roietronics | 27:373612b1cd94 | 19 | #endif |
| Roietronics | 27:373612b1cd94 | 20 | pm.setLog(&pc); //Attach a log output stream |
| Roietronics | 27:373612b1cd94 | 21 | pm.startAutoRead(); //Start the sensor in continous read mode |
| Roietronics | 27:373612b1cd94 | 22 | for(int index = 0; index < 5; index++) { //Display 5 readings |
| Roietronics | 27:373612b1cd94 | 23 | pm.getPMReadings(); |
| Roietronics | 27:373612b1cd94 | 24 | } |
| Roietronics | 27:373612b1cd94 | 25 | pm.stopAutoRead(); //Shut the sensor down |
| Roietronics | 27:373612b1cd94 | 26 | |
| Roietronics | 27:373612b1cd94 | 27 | } |
| Roietronics | 27:373612b1cd94 | 28 |
