Test program for SPS30

Dependencies:   SPS30-sensor

Committer:
ziqiyap
Date:
Wed Jan 23 10:04:44 2019 +0000
Revision:
0:732c556ef648
Child:
1:6a9693f310f7
made some changes to sensor driver and i2c freq

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ziqiyap 0:732c556ef648 1 #include <string>
ziqiyap 0:732c556ef648 2 #include "mbed.h"
ziqiyap 0:732c556ef648 3 #include "src/sensor_driver.h"
ziqiyap 0:732c556ef648 4
ziqiyap 0:732c556ef648 5 using namespace std;
ziqiyap 0:732c556ef648 6
ziqiyap 0:732c556ef648 7 Serial pc(SERIAL_TX, SERIAL_RX);
ziqiyap 0:732c556ef648 8
ziqiyap 0:732c556ef648 9 int main()
ziqiyap 0:732c556ef648 10 {
ziqiyap 0:732c556ef648 11 pc.printf("Hello World\r\n");
ziqiyap 0:732c556ef648 12 int count = 0;
ziqiyap 0:732c556ef648 13 while(1)
ziqiyap 0:732c556ef648 14 {
ziqiyap 0:732c556ef648 15 #ifdef SCD30
ziqiyap 0:732c556ef648 16 int rdy = readySCD30();
ziqiyap 0:732c556ef648 17 setSCDparam();
ziqiyap 0:732c556ef648 18 string readco2 = readSCDco2();
ziqiyap 0:732c556ef648 19 string readtemp = readSCDtemp();
ziqiyap 0:732c556ef648 20 string readhum = readSCDhum();
ziqiyap 0:732c556ef648 21 if (rdy != 1) pc.printf("SCD30 not connected\r\n");
ziqiyap 0:732c556ef648 22 pc.printf("count: %d CO2: %s ppm Temp: %s C Hum: %s % \r\n", count, readco2, readtemp, readhum);
ziqiyap 0:732c556ef648 23 #endif
ziqiyap 0:732c556ef648 24 wait(5);
ziqiyap 0:732c556ef648 25 count++;
ziqiyap 0:732c556ef648 26 }
ziqiyap 0:732c556ef648 27 }