![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Test BME80
Revision 2:8b4e41e5a4a1, committed 2021-09-21
- Comitter:
- zillkhan
- Date:
- Tue Sep 21 12:08:54 2021 +0000
- Parent:
- 1:6dd878905b5c
- Commit message:
- test bme
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Tue Jun 16 05:47:24 2020 +0000 +++ b/main.cpp Tue Sep 21 12:08:54 2021 +0000 @@ -1,34 +1,26 @@ #include "mbed.h" #include "mbed_bme680.h" -#if TARGET_NUMAKER_IOT_M263A -I2C i2c(PD_4, PD_5); -#else +#define I2C_SDA D14 +#define I2C_SCL D15 + I2C i2c(I2C_SDA, I2C_SCL); // Used inside the BME680 Mbed Lib. -#endif -BME680 bme680(0x76 << 1); +BME680 bme680(0xEE); int main() -{ - int count = 10; - +{ if (!bme680.begin()) { printf("BME680 Begin failed \r\n"); return 1; } while (true) { - if (++count >= 10) + if (bme680.performReading()) { - count = 0; printf("\r\nTemperature Humidity Pressure VOC\r\n" " degC %% hPa KOhms\r\n" "------------------------------------------\r\n"); - } - - if (bme680.performReading()) - { printf(" %.2f ", bme680.getTemperature()); printf("%.2f ", bme680.getHumidity()); printf("%.2f ", bme680.getPressure() / 100.0);