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
00001 #include "mbed.h" 00002 #include "CCS811.h" 00003 00004 I2C i2c (I2C_SDA,I2C_SCL); 00005 Serial bluetooth(p9,p10); 00006 00007 #ifdef TARGET_UBLOX_EVK_ODIN_W2 00008 CCS811 ccs811(p9, p10); 00009 #else 00010 CCS811 ccs811(I2C_SDA, I2C_SCL); 00011 #endif 00012 00013 uint16_t eco2, tvoc; 00014 00015 00016 void CCS811Callback(void) 00017 { 00018 bluetooth.baud(56000); 00019 //ccs811.readData(&eco2, &tvoc); 00020 //bluetooth.printf("eCO2 reading :%dppm, TVOC reading :%dppb\r\n", eco2, tvoc); 00021 00022 ccs811.readData(&eco2, &tvoc); 00023 bluetooth.printf("eCO2 reading :%dppm", eco2); 00024 } 00025 00026 int main() 00027 { 00028 bluetooth.baud(56000); 00029 ccs811.init(); 00030 wait(1); 00031 00032 while(1) 00033 { 00034 ccs811.readstatus(); //0x90 reports everything working, 0x98 measurement ready to be used 00035 wait(1); 00036 CCS811Callback(); 00037 wait(1); 00038 } 00039 }
Generated on Sun Aug 14 2022 21:16:35 by
 1.7.2