[arm] 1
Viewer
*** This page was generated with the meta tag "noindex, nofollow". This happened because you selected this option before saving or the system detected it as spam. This means that this page will never get into the search engines and the search bot will not crawl it. There is nothing to worry about, you can still share it with anyone.
- #include <Wire.h>
- #include <SparkFunCCS811.h>
- CCS811 ccs;
- void setup()
- {
- Serial.begin(9600);
- Wire.begin();
- if(!ccs.begin())
- {
- Serial.println("Не удалось инициализировать датчик CCS811. Проверьте подключение.");
- while(1);
- }
- Serial.println("Датчик CCS811 готов к работе.");
- }
- void loop()
- {
- if(ccs.available())
- {
- if(!ccs.readData())
- {
- Serial.println("Ошибка чтения данных с датчика.");
- return;
- }
- Serial.print("CO2: ");
- Serial.print(ccs.getCO2());
- Serial.print(" ppm, TVOC: ");
- Serial.print(ccs.getTVOC());
- Serial.println(" ppb");
- delay(1000); // Задержка между измерениями
- }
- else if(ccs.checkForStatusError())
- {
- Serial.println("Ошибка статуса датчика. Перезагрузите его.");
- }
- else if(ccs.checkForDataReady())
- {
- Serial.println("Данные готовы для чтения.");
- }
- delay(100); // Минимальная задержка между проверками состояния датчика
- }
Editor
You can edit this paste and save as new: