worked

Files at this revision

API Documentation at this revision

Comitter:
morgandu
Date:
Tue Jun 09 02:35:34 2020 +0000
Child:
1:6dd878905b5c
Commit message:
Initial version

Changed in this revision

.gitignore Show annotated file Show diff for this revision Revisions of this file
BME680.lib Show annotated file Show diff for this revision Revisions of this file
BME680_driver.lib Show annotated file Show diff for this revision Revisions of this file
README.md Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-os.lib Show annotated file Show diff for this revision Revisions of this file
mbed_app.json Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.gitignore	Tue Jun 09 02:35:34 2020 +0000
@@ -0,0 +1,4 @@
+.build
+.mbed
+projectfiles
+*.py*
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/BME680.lib	Tue Jun 09 02:35:34 2020 +0000
@@ -0,0 +1,1 @@
+https://github.com/sensidev/BME680/#cd2aeb67003ce13c4e51a56a4fb935844289de53
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/BME680_driver.lib	Tue Jun 09 02:35:34 2020 +0000
@@ -0,0 +1,1 @@
+https://github.com/BoschSensortec/BME680_driver/#9014031fa00a5cc1eea1498c4cd1f94ec4b8ab11
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/README.md	Tue Jun 09 02:35:34 2020 +0000
@@ -0,0 +1,9 @@
+# Control Bosch BME680 sensor on NuMaker-IoT-M263A
+
+This example integrates codes from Bosch sensor driver and https://github.com/sensidev/BME680/ to 
+control and read the temperature, humidity, pressure, and VOC values from Bosch BME680 sensor on
+Nuvoton NuMaker board.
+
+## Required hardware
+* Supported target -
+ [NuMaker-IoT-M263A](https://os.mbed.com/platforms/NUMAKER-IOT-M263A/)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Jun 09 02:35:34 2020 +0000
@@ -0,0 +1,40 @@
+#include "mbed.h"
+#include "mbed_bme680.h"
+
+#if TARGET_NUMAKER_IOT_M263A
+I2C sensor_i2c(PD_4, PD_5);
+#else
+I2C sensor_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);
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-os.lib	Tue Jun 09 02:35:34 2020 +0000
@@ -0,0 +1,1 @@
+https://github.com/ARMmbed/mbed-os/#b6370b4c37f3d4665ed1cdcb1afea85396bba1b3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed_app.json	Tue Jun 09 02:35:34 2020 +0000
@@ -0,0 +1,8 @@
+{
+    "target_overrides": {
+        "*": {
+            "platform.stdio-baud-rate"          : 115200,
+            "platform.stdio-convert-newlines"   : true
+        }
+    }
+}