Steve Mylroie / Mbed OS HPM_Tester

Dependencies:   HPM

Fork of frdm_https_HPM by mDot

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Main.cpp Source File

Main.cpp

00001 #include "mbed.h"
00002 #include "HPM.h"
00003 
00004 #define TESTER_VERSION 1.0
00005 
00006 Serial pc(USBTX, USBRX, 115200);
00007 
00008 #if MODE == 4
00009 RawSerial link(D0, D1);
00010 #endif
00011 
00012 main()
00013 {
00014     pc.printf("Starting HPM library Tester Version %s\n", TESTER_VERSION);
00015 #if MODE == 4
00016     HPM pm(&link);
00017 #else
00018     HPM pm(D1, D0);  //Create an instance of a HPM class object
00019 #endif
00020     pm.setLog(&pc);  //Attach a log output stream
00021     pm.startAutoRead(); //Start the sensor in continous read mode
00022     for(int index = 0; index < 5; index++) { //Display 5 readings
00023         pm.getPMReadings(); 
00024         }
00025     pm.stopAutoRead(); //Shut the sensor down
00026     
00027     }
00028