Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /********* 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: Sensor Readings
- - Source Code compiled for: Arduino Uno
- - Source Code created on: 2024-01-06 18:18:03
- ********* Pleasedontcode.com **********/
- /****** SYSTEM REQUIREMENTS *****/
- /****** SYSTEM REQUIREMENT 1 *****/
- /* bhhhhhhhvgbh yubjyhu */
- /****** END SYSTEM REQUIREMENTS *****/
- /****** DEFINITION OF LIBRARIES *****/
- #include <Arduino.h>
- #include <DHT.h>
- /****** FUNCTION PROTOTYPES *****/
- void setup(void);
- void loop(void);
- /***** DEFINITION OF DIGITAL INPUT PINS *****/
- const uint8_t DHTPIN = 2;
- /****** DEFINITION OF LIBRARY CLASS INSTANCES*****/
- DHT dht(DHTPIN, DHT22);
- void setup(void)
- {
- // put your setup code here, to run once:
- pinMode(DHTPIN, INPUT_PULLUP);
- dht.begin();
- // System Requirement 1: Initialize Serial communication
- Serial.begin(9600);
- }
- void loop(void)
- {
- // put your main code here, to run repeatedly:
- delay(2000); // System Requirement 2: Delay before each measurement
- // Read temperature and humidity from DHT sensor
- float temperature = dht.readTemperature();
- float humidity = dht.readHumidity();
- // System Requirement 3: Print temperature and humidity values
- Serial.print("Temperature: ");
- Serial.print(temperature);
- Serial.println("°C");
- Serial.print("Humidity: ");
- Serial.print(humidity);
- Serial.println("%");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement