ELEC6245 - Wireless Networks
/
C027_BME280
Sensor code
Revision 0:aa05800d8feb, committed 2016-12-01
- Comitter:
- maximusismax
- Date:
- Thu Dec 01 11:19:21 2016 +0000
- Commit message:
- Simple code
Changed in this revision
diff -r 000000000000 -r aa05800d8feb BME280.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/BME280.lib Thu Dec 01 11:19:21 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/MACRUM/code/BME280/#ddcaa259e65b
diff -r 000000000000 -r aa05800d8feb main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Dec 01 11:19:21 2016 +0000 @@ -0,0 +1,29 @@ +#include "mbed.h" +#include "BME280.h" +#ifdef TARGET_UBLOX_C027 + #include "C027_api.h" +#else + #error "This example is targeted for the C027 platform" +#endif + +DigitalOut myled(LED1); +Serial pc(USBTX, USBRX); +I2C i2c(P0_0, P0_1); +BME280 sensor(i2c); + +int main() { + float temp = 0; + float pres = 0; + float humid = 0; + + + sensor.initialize(); + while(1) { + myled = !myled; + wait(0.2); + temp = sensor.getTemperature(); + pres = sensor.getPressure(); + humid = sensor.getHumidity(); + pc.printf("temp: %f, pres: %f, humid: %f\n", temp, pres, humid); + } +} \ No newline at end of file
diff -r 000000000000 -r aa05800d8feb mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Dec 01 11:19:21 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/d75b3fe1f5cb \ No newline at end of file