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.
Revision 0:fcddd87b788e, committed 2020-03-05
- Comitter:
- rollman
- Date:
- Thu Mar 05 08:27:47 2020 +0000
- Child:
- 1:4be4b811b40e
- Commit message:
- Initial commit
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/CCS811.lib Thu Mar 05 08:27:47 2020 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/teams/MtM/code/CCS811/#ec392b3a49f2
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Mar 05 08:27:47 2020 +0000 @@ -0,0 +1,34 @@ +#include "mbed.h" +#include "CCS811.h" + + +int main() { + Serial m_pc(USBTX, USBRX); + m_pc.baud(9600); + + I2C i2c_ccs811(p28, p27); + // i2c_ccs811.frequency(100000); + CCS811 ccs(i2c_ccs811, m_pc); + + { + char res = ccs.init(); + if (res != 0) printerr(m_pc, res); + } + + { + char status = ccs.readStatus(); + if (status & 0x01){ + char errid = ccs.readErr(); + printerr_reg1(m_pc, errid); + } + } + m_pc.printf("Init Done\r\n"); + + uint16_t co2, tvoc; + while(1) { + while(!ccs.readStatus() & 0x08); // wait for DATA_READY + ccs.readData(&co2, &tvoc); + m_pc.printf("%d %d\r\n", co2, tvoc); + wait(0.5); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Mar 05 08:27:47 2020 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400 \ No newline at end of file