Advertisement
pleasedontcode

"Temperature Switch" rev_01

Jan 6th, 2024
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /********* Pleasedontcode.com **********
  2.  
  3.     Pleasedontcode thanks you for automatic code generation! Enjoy your code!
  4.  
  5.     - Terms and Conditions:
  6.     You have a non-exclusive, revocable, worldwide, royalty-free license
  7.     for personal and commercial use. Attribution is optional; modifications
  8.     are allowed, but you're responsible for code maintenance. We're not
  9.     liable for any loss or damage. For full terms,
  10.     please visit pleasedontcode.com/termsandconditions.
  11.  
  12.     - Project: "Temperature Switch"
  13.     - Source Code compiled for: Arduino Uno
  14.     - Source Code created on: 2024-01-06 11:01:08
  15.  
  16. ********* Pleasedontcode.com **********/
  17.  
  18. /****** SYSTEM REQUIREMENTS *****/
  19. /****** SYSTEM REQUIREMENT 1 *****/
  20.     /* Temperature control switch */
  21. /****** END SYSTEM REQUIREMENTS *****/
  22.  
  23. /****** DEFINITION OF LIBRARIES *****/
  24. #include <Arduino.h>
  25. #include <EasyButton.h>
  26.  
  27. /****** FUNCTION PROTOTYPES *****/
  28. void setup(void);
  29. void loop(void);
  30. void temperatureControlSwitchPressed(void);
  31.  
  32. /***** DEFINITION OF DIGITAL INPUT PINS *****/
  33. const uint8_t temperatureControlSwitchPin = 2;
  34.  
  35. /****** DEFINITION OF LIBRARY CLASS INSTANCES *****/
  36. EasyButton temperatureControlSwitch(temperatureControlSwitchPin);
  37.  
  38. void setup(void)
  39. {
  40.     // Set up the temperature control switch pin as input with internal pull-up resistor
  41.     pinMode(temperatureControlSwitchPin, INPUT_PULLUP);
  42.  
  43.     // Attach the temperatureControlSwitchPressed function as the callback for button pressed event
  44.     temperatureControlSwitch.onPressed(temperatureControlSwitchPressed);
  45. }
  46.  
  47. void loop(void)
  48. {
  49.     // Update the state of the temperature control switch button
  50.     temperatureControlSwitch.read();
  51.  
  52.     // Add your main code here
  53. }
  54.  
  55. void temperatureControlSwitchPressed(void)
  56. {
  57.     // Code to control the temperature goes here
  58.     // This function will be called when the temperature control switch is pressed
  59.     // Add temperature control logic here
  60. }
  61.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement