Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
/********* Pleasedontcode.com ********** Pleasedontcode thanks you for automatic code generation! Enjoy your code! - Terms and Conditions: You have a non-exclusive, revocable, worldwide, royalty-free license for personal and commercial use. Attribution is optional; modifications are allowed, but you're responsible for code maintenance. We're not liable for any loss or damage. For full terms, please visit pleasedontcode.com/termsandconditions. - Project: "Temperature Display" - Source Code NOT compiled for: Arduino Uno - Source Code created on: 2025-02-07 14:36:51 ********* Pleasedontcode.com **********/ /****** SYSTEM REQUIREMENTS *****/ /****** SYSTEM REQUIREMENT 1 *****/ /* Implementar un sistema de notificación que */ /* enciende un LED si el sensor DHT22 detecta */ /* temperatura sobre 28°C o humedad sobre 65%, */ /* asegurando una supervisión constante del entorno. */ /****** END SYSTEM REQUIREMENTS *****/ /* START CODE */ /****** DEFINITION OF LIBRARIES *****/ #include
//https://github.com/RobTillaart/DHTlib #include
#include
/****** FUNCTION PROTOTYPES *****/ void setup(void); void loop(void); /****** DEFINITION OF LIBRARIES CLASS INSTANCES*****/ // Configura los pines y objetos #define DHTPIN 2 // Digital pin connected to the DHT sensor #define DHTTYPE DHT11 // DHT 11 #define LCD_ADDR 0x27 // Dirección I2C del LCD (puede variar) #define LED_PIN 13 // Pin connected to the LED DHT dht(DHTPIN, DHTTYPE); LiquidCrystal_I2C lcd(LCD_ADDR, 16, 2); void setup(void) { // put your setup code here, to run once: Serial.begin(115200); // Inicializa el sensor DHT y el LCD dht.begin(); lcd.init(); lcd.backlight(); // Configura el pin del LED como salida pinMode(LED_PIN, OUTPUT); } void loop(void) { // put your main code here, to run repeatedly: // Lee la temperatura y humedad float h = dht.readHumidity(); float t = dht.readTemperature(); // Muestra la información en el LCD lcd.clear(); lcd.setCursor(0, 0); lcd.setCursor(10, 0); lcd.print("T:"); lcd.print(t); lcd.print("C "); lcd.setCursor(10, 1); lcd.print("H:"); lcd.print(h); lcd.print("%"); // Verifica las condiciones de temperatura y humedad if (t > 28.0 || h > 65.0) { digitalWrite(LED_PIN, HIGH); // Enciende el LED } else { digitalWrite(LED_PIN, LOW); // Apaga el LED } delay(2000); } /* END CODE */
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)