2024-10-2600 LED-Ansteuerung

This commit is contained in:
hans-jurgen 2024-10-26 14:05:40 +02:00
parent 920bf28c32
commit c723542be7

View File

@ -16,6 +16,7 @@ Updated by Bodmer for variable meter size
*/ */
#define ledGreen 16 #define ledGreen 16
#define ledRed 4 /* rot */
// Define meter size as 1 for tft.rotation(0) or 1.3333 for tft.rotation(1) // Define meter size as 1 for tft.rotation(0) or 1.3333 for tft.rotation(1)
#define M_SIZE 1.3333 #define M_SIZE 1.3333
@ -89,7 +90,6 @@ void setup(void) {
updateTime = millis(); // Next update time updateTime = millis(); // Next update time
pinMode(ledGreen, OUTPUT); pinMode(ledGreen, OUTPUT);
analogWrite(ledGreen, 102);
//init_HTU21(); //init_HTU21();
//delay(5000); //delay(5000);
} }
@ -142,6 +142,24 @@ void loop() {
tft.drawString("%", 270, 210, 4); tft.drawString("%", 270, 210, 4);
} }
Serial.print(Temperatur,4); Serial.println(" °C"); Serial.print(Temperatur,4); Serial.println(" °C");
if ((event.relative_humidity >=65) & (event.relative_humidity<=75)){
analogWrite(ledGreen, 255-165);
analogWrite(ledRed, 0);
//Serial.println("LEDGreen-AN");
}
else if ((event.relative_humidity >=50) & (event.relative_humidity<=65)){
analogWrite(ledGreen, 0);
analogWrite(ledRed, 255);
//Serial.println("LEDGreen-AN");
}
else if (event.relative_humidity >=75){
analogWrite(ledRed, 0);
analogWrite(ledGreen, 255);
//Serial.println("LED-RedAN");
} else {
analogWrite(ledRed, 255);
//Serial.println("LEDRed-AUS");
}
} }
} }