UV Sensor
#include <Wire.h> #include <LiquidCrystal_I2C.h> #include "Adafruit_SI1145.h" Adafruit_SI1145 uv = Adafruit_SI1145(); LiquidCrystal_I2C lcd(0x3F,20,4); void setup() { lcd.init(); Serial.begin(9600); if (! uv.begin()) { Serial.println("Didn't find Si1145"); while (1); } Serial.println("OK!"); } void loop() { Serial.println("==================="); Serial.print("Vis: "); Serial.println(uv.readVisible()); Serial.print("IR: "); Serial.println(uv.readIR()); Serial.print("UV: "); Serial.println(uv.readUV()/100.0); lcd.backlight(); lcd.setCursor(0,0); lcd.print("Vis: "); lcd.setCursor(5,0); lcd.print(uv.readVisible()); lcd.setCursor(0,1); lcd.print("IR: "); lcd.setCursor(5,1); lcd.print(uv.readIR()); lcd.setCursor(0,2); lcd.print("UV: "); lcd.setCursor(5,2); lcd.print(uv.readUV()/100.0); delay(1000); }
[свернуть]