Browse Source

UV sensor

ir
Hendrik Langer 5 years ago
parent
commit
1b96c58381
  1. 2
      platformio.ini
  2. 11
      src/main.cpp

2
platformio.ini

@ -35,6 +35,8 @@ lib_deps =
Adafruit GFX Library
Adafruit BME280 Library
Adafruit Unified Sensor
Adafruit BusIO
Adafruit VEML6075 Library
; SDS011 sensor Library
; Nova Fitness Sds dust sensors library
https://github.com/lewapek/sds-dust-sensors-arduino-library.git

11
src/main.cpp

@ -21,6 +21,8 @@
#include <Adafruit_Sensor.h>
#include "Adafruit_BME280.h"
#include "Adafruit_VEML6075.h"
#define ARDUINO_SAMD_VARIANT_COMPLIANCE
#include "SdsDustSensor.h"
@ -36,6 +38,7 @@ GxEPD2_BW<GxEPD2_213_B72, GxEPD2_213_B72::HEIGHT> display(GxEPD2_213_B72(/*CS=SS
Adafruit_BME280 bme; // I2C (also available: hardware SPI
//HardwareSerial Serial2(2);
SdsDustSensor sds(Serial2);
Adafruit_VEML6075 uv = Adafruit_VEML6075();
XD0OTA ota("esp32-weatherstation");
XD0MQTT mqtt;
@ -148,6 +151,10 @@ void setup()
bme.setGasHeater(320, 150); // 320*C for 150 ms
*/
if (! uv.begin()) {
Serial.println("Failed to communicate with VEML6075 sensor, check wiring?");
}
sds.begin();
display.clearScreen();
@ -279,6 +286,10 @@ void loop()
printValues();
Serial.print("UV Index reading: "); Serial.println(uv.readUVI());
Serial.print("Raw UVA reading: "); Serial.println(uv.readUVA());
Serial.print("Raw UVB reading: "); Serial.println(uv.readUVB());
if(wifiMulti.run() != WL_CONNECTED) {
Serial.println("WiFi not connected!");
delay(1000);

Loading…
Cancel
Save