     return false;
 }
 
-bool writeToUbidots(float temperature, float humidity) {
+bool writeToUbidots(float temperature, float humidity, uint16_t brightness) {
     const uint8_t DATA_LOGGING_ATTEMPTS = 3;
     const uint8_t DATA_LOGGING_INTERVAL = 5 * 1000;
 
     Serial.println("Writing to Ubidots");
 
-	Ubidots ubidots = Ubidots((char*)UBIDOTS_TOKEN, "things.ubidots.com");
+    Ubidots ubidots = Ubidots((char*)UBIDOTS_TOKEN, "things.ubidots.com");
     for (int dataLoggingAttempt = 0; dataLoggingAttempt < DATA_LOGGING_ATTEMPTS; dataLoggingAttempt++) {
-		ubidots.add((char*)UBIDOTS_ID_TEMPERATURE, temperature);
-		ubidots.add((char*)UBIDOTS_ID_HUMIDITY, humidity);
-
-		bool writeSuccessful = ubidots.sendAll();
+        ubidots.add((char*)UBIDOTS_ID_TEMPERATURE, temperature);
+        ubidots.add((char*)UBIDOTS_ID_HUMIDITY, humidity);
+        ubidots.add((char*)UBIDOTS_ID_BRIGHTNESS, brightness);
+
+        bool writeSuccessful = ubidots.sendAll();
 
         if (writeSuccessful) {
             Serial.println("Writing to Ubidots successful");



// Methods
bool readSensorData(float* temperature, float* humidity) {
    const uint8_t SENSOR_READING_ATTEMPTS = 3;
    const uint8_t SENSOR_READING_INTERVAL = 3 * 1000;


        if (!isHumidityValid) {
            Serial.print("Reading valid humidity failed: ");
            Serial.println(*humidity);
        }
        if (!isBrightnessValid) {
            Serial.print("Reading valid brightness failed: ");
            Serial.println(*brightness);
        }

        // Wait in between attempts
