I have a seeeduino lotus with this code. #include <SensirionI2CSht4x.h>
#include <Wire.h>
#include “rgb_lcd.h”
const int ledPin = 5;
const int buttonPin = 6;
int buttonState = 0;
SensirionI2CSht4x sht4x;
rgb_lcd lcd;
void setup() {
pinMode(ledPin, OUTPUT);
pinMode(buttonPin, INPUT);
Serial.begin(115200);
lcd.begin(16,2);
//initializes the I2C communication
Wire.begin();
sht4x.begin(Wire);
}
void loop() {
buttonState = digitalRead(buttonPin);
float temperature;
float humidity;
float limitTemp = 10.0;
float limitHumi = 50.0;
//reads the temperature and humidity values from the sensor over the I2C connection
uint16_t error = sht4x.measureHighPrecision(temperature, humidity);
if (buttonState == HIGH)
{
lcd.print("Temp: ");
lcd.print(temperature);
lcd.setCursor(0,1);
lcd.print("Humi: ");
lcd.print(humidity);
delay(3000);
lcd.clear();
}
if (temperature >= limitTemp || humidity >= limitHumi) {
lcd.clear();
lcd.print("Temp: ");
lcd.print(temperature);
lcd.setCursor(0,1);
lcd.print("Humi: ");
lcd.print(humidity);
int colorR = 255;
int colorG = 0;
int colorB = 0;
lcd.setRGB(colorR,colorG,colorB);
}
}
when the temperature changes to above 10 (which is just to test, it will be much higher later) but still it dosent change colour.