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.
Diff: main.cpp
- Revision:
- 0:2c1dce3543ae
- Child:
- 1:d0abe05bc21e
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Mon Sep 06 09:17:14 2021 +0000
@@ -0,0 +1,38 @@
+#include "mbed.h"
+#include "CCS811.h"
+
+I2C i2c (I2C_SDA,I2C_SCL);
+Serial bluetooth(p9,p10);
+
+#ifdef TARGET_UBLOX_EVK_ODIN_W2
+CCS811 ccs811(p9, p10);
+#else
+CCS811 ccs811(I2C_SDA, I2C_SCL);
+#endif
+
+uint16_t eco2, tvoc;
+
+
+void CCS811Callback(void)
+{
+ bluetooth.baud(56000);
+ //ccs811.readData(&eco2, &tvoc);
+ //bluetooth.printf("eCO2 reading :%dppm, TVOC reading :%dppb\r\n", eco2, tvoc);
+
+ ccs811.readData(&eco2, &tvoc);
+ bluetooth.printf("eCO2 reading :%dppm", eco2);
+}
+
+int main()
+{
+ bluetooth.baud(56000);
+ ccs811.init();
+ wait(1);
+
+ while(1) {
+ ccs811.readstatus(); //0x90 reports everything working, 0x98 measurement ready to be used
+ wait(1);
+ CCS811Callback();
+ wait(1);
+ }
+}
\ No newline at end of file