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: Scanner
- - Source Code compiled for: Arduino Uno
- - Source Code created on: 2023-11-01 19:48:35
- - Source Code generated by: AlexWind
- ********* Pleasedontcode.com **********/
- /****** DEFINITION OF LIBRARIES *****/
- #include <Arduino.h>
- #include <DS18B20.h>
- /****** SYSTEM REQUIREMENT 1 *****/
- /* if temperature is > 50°C so activate the relay for */
- /* 45,5 seconds and then deactivate. */
- /****** FUNCTION PROTOTYPES *****/
- void setup(void);
- void loop(void);
- /***** DEFINITION OF DIGITAL INPUT PINS *****/
- const uint8_t temperature_DS18B20_DQ_PIN_D2 = 2;
- /***** DEFINITION OF DIGITAL OUTPUT PINS *****/
- const uint8_t relay_PIN_D3 = 3;
- /****** DEFINITION OF LIBRARIES CLASS INSTANCES*****/
- DS18B20 ds(temperature_DS18B20_DQ_PIN_D2);
- void setup(void)
- {
- // put your setup code here, to run once:
- pinMode(relay_PIN_D3, OUTPUT);
- }
- void loop(void)
- {
- // put your main code here, to run repeatedly:
- float temperature = ds.getTempC();
- if (temperature > 50.0)
- {
- digitalWrite(relay_PIN_D3, HIGH); // Activate the relay
- delay(45500); // Wait for 45.5 seconds
- digitalWrite(relay_PIN_D3, LOW); // Deactivate the relay
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement