Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp
- Committer:
- morgandu
- Date:
- 2020-06-16
- Revision:
- 1:6dd878905b5c
- Parent:
- 0:a0e92a018ff2
- Child:
- 2:c6442e972e68
File content as of revision 1:6dd878905b5c:
#include "mbed.h"
#include "mbed_bme680.h"
#if TARGET_NUMAKER_IOT_M263A
I2C i2c(PD_4, PD_5);
#else
I2C i2c(I2C_SDA, I2C_SCL); // Used inside the BME680 Mbed Lib.
#endif
BME680 bme680(0x76 << 1);
int main()
{
int count = 10;
if (!bme680.begin()) {
printf("BME680 Begin failed \r\n");
return 1;
}
while (true) {
if (++count >= 10)
{
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);
printf("%0.2f\r\n", bme680.getGasResistance() / 1000.0);
}
thread_sleep_for(1000);
}
}