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 00005 00006 Serial pc(USBTX, USBRX); 00007 00008 #ifdef TARGET_UBLOX_EVK_ODIN_W2 00009 CCS811 ccs811(PF_0, PF_1); 00010 #else 00011 CCS811 ccs811(I2C_SDA, I2C_SCL); 00012 #endif 00013 00014 00015 uint16_t eco2, tvoc; 00016 00017 00018 void CCS811Callback(void) 00019 { 00020 00021 ccs811.readData(&eco2, &tvoc); 00022 00023 pc.printf("eCO2 reading :%dppm, TVOC reading :%dppb\r\n", eco2, tvoc); 00024 00025 } 00026 00027 00028 int main() 00029 { 00030 ccs811.init(); 00031 wait(1); 00032 00033 while(1) { 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 Wed Jul 20 2022 08:49:35 by
1.7.2
Air Quality Breakout - CCS811