Remember to maintain security and privacy. Do not share sensitive information. Procedimento.com.br may make mistakes. Verify important information. Termo de Responsabilidade
Embedded systems play a crucial role in various industries and everyday devices, making them an essential topic for engineers and developers. These systems combine hardware and software to perform specific tasks efficiently and reliably. Understanding the fundamentals of embedded systems is vital for anyone working in the field of electronics and programming.
Project: Temperature and Humidity Monitoring System
In this project, we will create a temperature and humidity monitoring system using an Arduino board. The objective is to measure and display real-time temperature and humidity values on an LCD screen. This system can be used in various applications, such as home automation, greenhouse monitoring, or industrial control.
List of components:
You can find these components at the following links:
Examples:
Example 1: Reading Temperature and Humidity Values
#include <dht.h>
#include <LiquidCrystal.h>
#define DHTPIN 2
dht DHT;
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup() {
lcd.begin(16, 2);
}
void loop() {
int chk = DHT.read11(DHTPIN);
lcd.setCursor(0, 0);
lcd.print("Temperature: ");
lcd.print(DHT.temperature);
lcd.print("C");
lcd.setCursor(0, 1);
lcd.print("Humidity: ");
lcd.print(DHT.humidity);
lcd.print("%");
delay(2000);
}
Explanation:
setup()
function, we initialize the LCD screen.loop()
function, we read the temperature and humidity values from the DHT11 sensor using the read11()
function.print()
function.Example 2: Controlling an LED based on Temperature
#include <dht.h>
#define DHTPIN 2
#define LEDPIN 13
dht DHT;
void setup() {
pinMode(LEDPIN, OUTPUT);
}
void loop() {
int chk = DHT.read11(DHTPIN);
if (DHT.temperature > 25) {
digitalWrite(LEDPIN, HIGH);
} else {
digitalWrite(LEDPIN, LOW);
}
delay(1000);
}
Explanation:
setup()
function, we set the LED pin as an output.loop()
function, we read the temperature value from the DHT11 sensor using the read11()
function.