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: Humidity Control - Source Code compiled for: Arduino Uno - Source Code created on: 2024-02-29 06:09:53 ********* Pleasedontcode.com **********/ /****** SYSTEM REQUIREMENTS *****/ /****** SYSTEM REQUIREMENT 1 *****/ /* turn on ULTRASONIOC when humiditi hit below 70% */ /****** SYSTEM REQUIREMENT 2 *****/ /* stop ULTRASONIC when humidity is above 90% */ /****** END SYSTEM REQUIREMENTS *****/ /****** DEFINITION OF LIBRARIES *****/ #include
//https://github.com/Zanduino/BME280 #include
//https://github.com/adafruit/DHT-sensor-library /****** FUNCTION PROTOTYPES *****/ void setup(void); void loop(void); void updateOutputs(void); /***** DEFINITION OF DIGITAL INPUT PINS *****/ const uint8_t humiditysensor_DHT22_DOUT_PIN_D2 = 2; const uint8_t humiditysensor_DHT22_DOUT_PIN_D3 = 3; /***** DEFINITION OF DIGITAL OUTPUT PINS *****/ const uint8_t ULTRASONIC_PIN_D4 = 4; /***** DEFINITION OF OUTPUT RAW VARIABLES *****/ /***** used to store raw data *****/ bool ULTRASONIC_PIN_D4_rawData = 0; /***** DEFINITION OF OUTPUT PHYSICAL VARIABLES *****/ /***** used to store data after characteristic curve transformation *****/ float ULTRASONIC_PIN_D4_phyData = 0.0; /****** DEFINITION OF LIBRARIES CLASS INSTANCES *****/ DHT dht(humiditysensor_DHT22_DOUT_PIN_D2, DHT22); BME280_Class bme280; void setup(void) { // put your setup code here, to run once: pinMode(humiditysensor_DHT22_DOUT_PIN_D2, INPUT_PULLUP); pinMode(humiditysensor_DHT22_DOUT_PIN_D3, INPUT_PULLUP); pinMode(ULTRASONIC_PIN_D4, OUTPUT); dht.begin(); bme280.begin(); } void loop(void) { // put your main code here, to run repeatedly: float humidity = dht.readHumidity(); // Read humidity value if (humidity < 70) { ULTRASONIC_PIN_D4_rawData = 1; // Turn on ULTRASONIC } else if (humidity > 90) { ULTRASONIC_PIN_D4_rawData = 0; // Turn off ULTRASONIC } updateOutputs(); // Refresh output data } void updateOutputs() { digitalWrite(ULTRASONIC_PIN_D4, ULTRASONIC_PIN_D4_rawData); }
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)