How to set up illuminance to display at Dashboard?
I set up my project weather station...see code below
unfortunately, I got an error regarding variables...
so here is my Illuminance which is a bit disappointing we can not see what type it is: string, int or float?
when I try to build it... I have error
Start verifying
/tmp/079528558/comfort_Station_Office_apr18a/comfort_Station_Office_apr18a.ino: In function 'void loop()':
/tmp/079528558/comfort_Station_Office_apr18a/comfort_Station_Office_apr18a.ino:43:56: error: cannot bind non-const lvalue reference of type 'int&' to an rvalue of type 'int'
carrier.Light.readColor(none, none, none, illuminance);
it works when I set up illuminance as Int
but then my values are not display on cloud
strangely it works on local hub
Any help will be appreciated ![]()
#include "thingProperties.h"
#include <Arduino_MKRIoTCarrier.h>
MKRIoTCarrier carrier;
void setup() {
// Initialize serial and wait for port to open:
Serial.begin(9600);
while (!Serial);
// Defined in thingProperties.h
initProperties();
// Connect to Arduino IoT Cloud
ArduinoCloud.begin(ArduinoIoTPreferredConnection);
//Get Cloud Info/errors , 0 (only errors) up to 4
setDebugMessageLevel(2);
ArduinoCloud.printDebugInfo();
//Wait to get cloud connection to init the carrier
while (ArduinoCloud.connected() != 1) {
ArduinoCloud.update();
delay(500);
}
delay(500);
CARRIER_CASE = true;
carrier.begin();
carrier.display.setRotation(0);
delay(1500);
}
void loop() {
ArduinoCloud.update();
carrier.Buttons.update();
while (!carrier.Light.colorAvailable()) {
delay(5);
}
int none;
carrier.Light.readColor(none, none, none, illuminance);
temperature = carrier.Env.readTemperature();
humidity = carrier.Env.readHumidity();
pressure = carrier.Pressure.readPressure();
if (carrier.Button0.onTouchDown()) {
//configuring display, setting background color, text size and text color
carrier.display.fillScreen(ST77XX_RED); //red background
carrier.display.setTextColor(ST77XX_WHITE); //white text
carrier.display.setTextSize(2); //medium sized text
carrier.display.setCursor(30, 110); //sets position for printing (x and y)
carrier.display.print("Temp: ");
carrier.display.print(temperature);
carrier.display.println(" C");
}
if (carrier.Button1.onTouchDown()) {
//configuring display, setting background color, text size and text color
carrier.display.fillScreen(ST77XX_BLUE); //red background
carrier.display.setTextColor(ST77XX_WHITE); //white text
carrier.display.setTextSize(2); //medium sized text
carrier.display.setCursor(30, 110); //sets new position for printing (x and y)
carrier.display.print("Humi: ");
carrier.display.print(humidity);
carrier.display.println(" %");
}
if (carrier.Button2.onTouchDown()) {
carrier.display.fillScreen(ST77XX_YELLOW);
carrier.display.setTextColor(ST77XX_RED);
carrier.display.setTextSize(2);
carrier.display.setCursor(30, 110);
carrier.display.print("Illuminance: ");
carrier.display.print(illuminance);
carrier.display.println(" lux");
}
if (carrier.Button3.onTouchDown()) {
carrier.display.fillScreen(ST77XX_WHITE);
carrier.display.setTextColor(ST77XX_RED);
carrier.display.setTextSize(2);
carrier.display.setCursor(30, 110);
carrier.display.print("Pressure: "); //kPa
carrier.display.print(pressure);
carrier.display.println(" kPa");
}
if (carrier.Button4.onTouchDown()) {
carrier.display.fillScreen(ST77XX_YELLOW);
carrier.display.setTextColor(ST77XX_RED);
carrier.display.setTextSize(2);
carrier.display.setCursor(30, 110);
if (humidity >= 60 && temperature >= 15 && temperature < 20) {
weather_report = "It is very humid ";
} else if (temperature >= 20 && humidity < 60) {
weather_report = "Warm and comfortable";
} else if (temperature <= 16 ) {
weather_report = "A little cold";
}
else {
weather_report = "Weather is normal";
}
}
//delay(3000);
//carrier.Buttons.update();
}




