Bmp280
Dependencies: BME280 BMP280 MS5803_14BA
main.cpp@0:81a749387ba2, 2017-11-08 (annotated)
- Committer:
- andrewbates11
- Date:
- Wed Nov 08 15:31:46 2017 +0000
- Revision:
- 0:81a749387ba2
Bmp280 testing
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
andrewbates11 | 0:81a749387ba2 | 1 | /* |
andrewbates11 | 0:81a749387ba2 | 2 | #include "mbed.h" |
andrewbates11 | 0:81a749387ba2 | 3 | #include "MS5803_14BA.h" |
andrewbates11 | 0:81a749387ba2 | 4 | |
andrewbates11 | 0:81a749387ba2 | 5 | // Serial comms |
andrewbates11 | 0:81a749387ba2 | 6 | Serial pc(USBTX, USBRX); |
andrewbates11 | 0:81a749387ba2 | 7 | |
andrewbates11 | 0:81a749387ba2 | 8 | MS5803_14BA ps = MS5803_14BA(p26,p27, MS5803_ADDRC_H); |
andrewbates11 | 0:81a749387ba2 | 9 | |
andrewbates11 | 0:81a749387ba2 | 10 | int main() { |
andrewbates11 | 0:81a749387ba2 | 11 | while(1) { |
andrewbates11 | 0:81a749387ba2 | 12 | ps.convert(); |
andrewbates11 | 0:81a749387ba2 | 13 | pc.printf("temp: %f, pressure: %f\n", ps.temperature, ps.pressure); |
andrewbates11 | 0:81a749387ba2 | 14 | wait(1); |
andrewbates11 | 0:81a749387ba2 | 15 | } |
andrewbates11 | 0:81a749387ba2 | 16 | } |
andrewbates11 | 0:81a749387ba2 | 17 | */ |
andrewbates11 | 0:81a749387ba2 | 18 | |
andrewbates11 | 0:81a749387ba2 | 19 | |
andrewbates11 | 0:81a749387ba2 | 20 | #include "mbed.h" |
andrewbates11 | 0:81a749387ba2 | 21 | #include "BMP280.h" |
andrewbates11 | 0:81a749387ba2 | 22 | |
andrewbates11 | 0:81a749387ba2 | 23 | Serial pc(USBTX, USBRX); |
andrewbates11 | 0:81a749387ba2 | 24 | |
andrewbates11 | 0:81a749387ba2 | 25 | BMP280 sensor(p26, p27); |
andrewbates11 | 0:81a749387ba2 | 26 | |
andrewbates11 | 0:81a749387ba2 | 27 | int main() { |
andrewbates11 | 0:81a749387ba2 | 28 | while(1) { |
andrewbates11 | 0:81a749387ba2 | 29 | pc.printf("%04.2f hPa \n", sensor.getPressure()); |
andrewbates11 | 0:81a749387ba2 | 30 | wait(1); |
andrewbates11 | 0:81a749387ba2 | 31 | } |
andrewbates11 | 0:81a749387ba2 | 32 | } |
andrewbates11 | 0:81a749387ba2 | 33 | |
andrewbates11 | 0:81a749387ba2 | 34 |