51 #define UV_SENSOR_ANALOG_PIN 0
55 uint32_t SLEEP_TIME = 30*1000;
62 uint16_t uvIndexValue [12] = { 50, 227, 318, 408, 503, 606, 696, 795, 881, 976, 1079, 1170};
76 uint32_t currentTime = millis();
78 uint16_t uv = analogRead(UV_SENSOR_ANALOG_PIN);
87 for (i = 0; i < 12; i++) {
88 if (uv <= uvIndexValue[i]) {
100 float vRange=uvIndexValue[i]-uvIndexValue[i-1];
101 float vCalc=uv-uvIndexValue[i-1];
102 uvIndex+=(1.0/vRange)*vCalc-1.0;
109 if ((uvIndex != lastUV)||(currentTime-lastSend >= 5UL*60UL*1000UL)) {
110 lastSend=currentTime;