Skip to content

Commit e84f05c

Browse files
committed
code cleaning
1 parent d0a8209 commit e84f05c

File tree

2 files changed

+8
-17
lines changed

2 files changed

+8
-17
lines changed

.gitignore

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,4 @@
44
.vscode/launch.json
55
.vscode/ipch
66
.DS_Store
7-
aws/lambdas/weather-station-writer/.serverless
8-
aws/cfn-templates/real-time-iot-device-monitoring-with-kinesis.template
9-
cmake-build-uno/
10-
cmake-build-debug
11-
CMakeLists.txt
12-
CMakeListsPrivate.txt
13-
.idea
7+
aws/lambdas/weather-station-writer/.serverless

src/main.cpp

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,6 @@ void setup() {
105105
lcd.blink();
106106
delay(3000);
107107
lcd.noBlink();
108-
109-
if (!uvSensor.begin()) {
110-
Serial.println("Didn't find Si1145");
111-
while (1);
112-
}
113108
}
114109

115110
void loop() {
@@ -132,20 +127,22 @@ void loop() {
132127
Serial.println(" endbuffer");
133128
}
134129

135-
// read from the digital pin
130+
// read from DHT11
136131
temperatureSensor.begin();
137132

133+
if (!uvSensor.begin()) {
134+
Serial.println("Didn't find Si1145");
135+
}
136+
138137
float temperature = temperatureSensor.readTemperature(); // return temperature in °C
139138
float humidity = temperatureSensor.readHumidity(); // return humidity in %
139+
// Compute heat index in Celsius (isFahrenheit = false)
140+
float heatIndex = temperatureSensor.computeHeatIndex(temperature, humidity, false);
140141
float uvIndex = uvSensor.readUV(); // the index is multiplied by 100 so to get the
141142

142143
// integer index, divide by 100!
143144
uvIndex /= 100.0;
144145

145-
// Compute heat index in Celsius (isFahrenheit = false)
146-
float heatIndex = temperatureSensor.computeHeatIndex(temperature, humidity, false);
147-
148-
149146
// check whether reading was successful or not
150147
if (temperature == NAN || humidity == NAN) { // NAN means no available data
151148
lcd.print("Reading failed.");

0 commit comments

Comments
 (0)