@@ -90,27 +90,26 @@ void setup() {
90
90
Serial.begin (9600 );
91
91
wifi.begin (9600 );
92
92
93
-
94
- if (!uvSensor.begin ()) {
95
- Serial.println (" Didn't find Si1145" );
96
- while (1 );
97
- }
98
-
99
93
// set up the LCD's number of columns and rows
100
94
lcd.begin (16 , 2 );
101
95
102
96
// put cursor at the begining of row 0, line 0
103
97
lcd.setCursor (0 , 0 );
104
98
105
99
// display a welcome message
106
- lcd.print (" Temp & Humidity" );
100
+ lcd.print (" Temp, Humidity" );
107
101
// go to second line
108
102
lcd.setCursor (0 , 1 );
109
- lcd.print (" Sensor" );
103
+ lcd.print (" and UV Sensor" );
110
104
111
105
lcd.blink ();
112
106
delay (3000 );
113
107
lcd.noBlink ();
108
+
109
+ if (!uvSensor.begin ()) {
110
+ Serial.println (" Didn't find Si1145" );
111
+ while (1 );
112
+ }
114
113
}
115
114
116
115
void loop () {
@@ -139,6 +138,7 @@ void loop() {
139
138
float temperature = temperatureSensor.readTemperature (); // return temperature in °C
140
139
float humidity = temperatureSensor.readHumidity (); // return humidity in %
141
140
float uvIndex = uvSensor.readUV (); // the index is multiplied by 100 so to get the
141
+
142
142
// integer index, divide by 100!
143
143
uvIndex /= 100.0 ;
144
144
@@ -160,6 +160,11 @@ void loop() {
160
160
lcd.print (" Temp (C): " );
161
161
lcd.print (String (temperature));
162
162
163
+ // display UVIndex on the LCD screen
164
+ lcd.setCursor (0 , 2 );
165
+ lcd.print (" UV: " );
166
+ lcd.print (String (uvIndex));
167
+
163
168
String preparedData = prepareDataForWiFi (humidity, temperature, heatIndex, uvIndex);
164
169
if (DEBUG == true ) {
165
170
Serial.println (preparedData);
0 commit comments