  * Required libraries:
  * ArduinoJson
  * Grove_SHT31_Temp_Humi_Sensor
- * Seeed_Arduino_FS
- * Seeed_Arduino_mbedtls
- * Seeed_Arduino_rpcUnified
- * Seeed_Arduino_rpcWiFi
- * Seeed_Arduino_SFUD
  */
 
-// CHANGE THESE before running!
-const char* SSID = "MyNetwork";
-const char* PASSWORD = "MyPassword";
-
-WebServer server(80);
 SHT31 sht31 = SHT31();
 
 const int ledPin = 13;
 
 // Reads the sensors and returns values as JSON
 String readSensors() {
+  digitalWrite(ledPin, 1);
+
+  const uint8_t lightMeasCount = 4;
+  int lightValuesSum = 0;
+
+  for (uint8_t i = 0; i < lightMeasCount; i++)
+    lightValuesSum += analogRead(A0);
+
   float temperature = sht31.getTemperature();
   float humidity = sht31.getHumidity();
-  int lightValue = analogRead(A0);
+  int lightValue = round((float)lightValuesSum / lightMeasCount);
   int builtInLightValue = analogRead(WIO_LIGHT);
 
   delay(400);

#include <rpcWiFi.h>
#include <WebServer.h>

#include <Wire.h>
#include "SHT31.h"



  serializeJson(doc, output);

  digitalWrite(ledPin, 0);

  return output;
}

void setup(void) {
  pinMode(A0, INPUT);
  pinMode(WIO_LIGHT, INPUT);
  pinMode(ledPin, OUTPUT);

  digitalWrite(ledPin, 1);

  Serial.begin(115200);

  sht31.begin();
}

void loop(void) {
  Serial.println(readSensors());
  delay(4000);
}
