本文使用的IIC协议 参考ltengy大佬的文章,需要的可以去github看看
https://ltengy.github.io//08 ... %E6%8C%87%E5%8D%97/
主程序根据CCS811手册来进行编写,程序如下:
[mw_shl_code=c,true]#include "sys.h"
#include "delay.h"
#include "usart.h"
#include "stdio.h"
#include "CCS811.h"
externccs811_measurement_t CCS;
int main(void)
{
u8 st1 = 0;
delay_init();
Uart1_init(115200);
CCS811Init();
app_Start();
delay_ms(150);
while(1)
{
st1 = CCS811_ReadOneByte(0x00);
switch(st1)
{
case 0x90:
{
setMode(MODE1);
}break;
case 0x98:
{
getData();
delay_ms(10);
if(CCS.eco2<10000)
{
printf("co2 &#