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:
- andcor02
- Date:
- 2017-10-19
- Revision:
- 1:ea90319c0b28
- Parent:
- 0:c53d931d771e
- Child:
- 2:f0800e58f4b0
File content as of revision 1:ea90319c0b28:
#include "mbed.h"
#include "CCS811.h"
Serial pc(USBTX, USBRX);
#ifdef TARGET_K64F
I2C i2c(I2C_SDA, I2C_SCL);
#endif
#ifdef TARGET_UBLOX_EVK_ODIN_W2
I2C i2c(PF_0, PF_1);
#endif
CCS811 ccs811(&i2c);
uint16_t eco2, tvoc;
void CCS811Callback(void)
{
ccs811.readData(&eco2, &tvoc);
pc.printf("eCO2 reading :%dppm, TVOC reading :%dppb\r\n", eco2, tvoc);
}
int main()
{
ccs811.init();
wait(1);
while(1) {
// ccs811.readstatus(); //0x90 reports everything working, 0x98 measurement ready to be used
wait(1);
CCS811Callback();
wait(1);
}
}
Air Quality Breakout - CCS811