/*************************************************************************** This is a library for the BME680 gas, humidity, temperature & pressure sensor Designed specifically to work with the Adafruit BME680 Breakout ----> http://www.adafruit.com/products/3660 These sensors use I2C or SPI to communicate, 2 or 4 pins are required to interface. Adafruit invests time and resources providing this open source code, please support Adafruit and open-source hardware by purchasing products from Adafruit! Written by Limor Fried & Kevin Townsend for Adafruit Industries. BSD license, all text above must be included in any redistribution ***************************************************************************/ #include #include "SparkFun_SCD30_Arduino_Library.h" //Click here to get the library: http://librarymanager/All#SparkFun_SCD30 SCD30 airSensor; #include #define PIN 4 // Parameter 1 = number of pixels in strip // Parameter 2 = Arduino pin number (most are valid) // Parameter 3 = pixel type flags, add together as needed: // NEO_KHZ800 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs) // NEO_KHZ400 400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers) // NEO_GRB Pixels are wired for GRB bitstream (most NeoPixel products) // NEO_RGB Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2) // NEO_RGBW Pixels are wired for RGBW bitstream (NeoPixel RGBW products) Adafruit_NeoPixel strip = Adafruit_NeoPixel(11, PIN, NEO_GRB + NEO_KHZ800); void setup() { Serial.begin(115200); Wire.begin(); airSensor.begin(); delay(5000); strip.begin(); strip.setBrightness(64); strip.show(); // Initialize all pixels to 'off' } void loop() { if (airSensor.dataAvailable()) { Serial.print("co2(ppm):"); Serial.print(airSensor.getCO2()); Serial.print(" temp(C):"); Serial.print(airSensor.getTemperature(), 1); Serial.print(" humidity(%):"); Serial.print(airSensor.getHumidity(), 1); Serial.println(); int ppm=airSensor.getCO2(); int c; if (ppm>2000) { c=strip.Color(255,0,0); } if (ppm>1000 && ppm<2000) { c=strip.Color(255,165,0); } if (ppm<1000) { c=strip.Color(0,128,0); } int ct=map(ppm, 0, 2000, 1, 11); for(uint16_t i=0; i