/********* 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 Control
- Source Code compiled for: Arduino Uno
- Source Code created on: 2024-02-13 09:51:16
********* Pleasedontcode.com **********/
/****** SYSTEM REQUIREMENTS *****/
/****** SYSTEM REQUIREMENT 1 *****/
/* The system shall turn off the light emitting diode */
/* connected to pin D2 when the button connected to */
/* pin D2 is pressed. */
/****** END SYSTEM REQUIREMENTS *****/
/****** DEFINITION OF LIBRARIES *****/
#include "DHT.h"
/****** FUNCTION PROTOTYPES *****/
void setup(void);
void loop(void);
/***** DEFINITION OF DIGITAL INPUT PINS *****/
const uint8_t buttonPin = 2;
const uint8_t ledPin = 3;
/****** DEFINITION OF LIBRARIES CLASS INSTANCES *****/
DHT dht(buttonPin, DHT22);
void setup(void) {
// put your setup code here, to run once:
pinMode(buttonPin, INPUT_PULLUP);
pinMode(ledPin, OUTPUT);
Serial.begin(9600);
}
void loop(void) {
// put your main code here, to run repeatedly:
if (digitalRead(buttonPin) == LOW) {
digitalWrite(ledPin, LOW); // Turn off the LED
} else {
digitalWrite(ledPin, HIGH); // Turn on the LED
}
}