/********* 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: homeAutomation
- Source Code compiled for: Arduino Uno
- Source Code created on: 2023-11-28 01:26:35
- Source Code generated by: Francesco Alessandro
********* Pleasedontcode.com **********/
/****** DEFINITION OF LIBRARIES *****/
#include
#include
/****** FUNCTION PROTOTYPES *****/
void setup(void);
void loop(void);
/***** DEFINITION OF DIGITAL INPUT PINS *****/
const uint8_t temperatureSensor_DS18B20_DQ_PIN_D2 = 2;
const uint8_t buzzerPin = 3; // Define the buzzer pin
/****** DEFINITION OF LIBRARIES CLASS INSTANCES*****/
DS18B20 ds(temperatureSensor_DS18B20_DQ_PIN_D2);
void setup(void)
{
// put your setup code here, to run once:
pinMode(buzzerPin, OUTPUT); // Set the buzzer pin as output
}
void loop(void)
{
// put your main code here, to run repeatedly:
float temperature = ds.getTempC(); // Use getTempC() instead of getTemperature()
if (temperature > 10) {
// Sound the buzzer
// TODO: Write code to sound the buzzer
digitalWrite(buzzerPin, HIGH);
} else {
digitalWrite(buzzerPin, LOW);
}
delay(1000);
}