Advertisement
pleasedontcode

fan_speed_control rev_01

Dec 1st, 2023
65
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: fan_speed_control
  13.     - Source Code compiled for: Arduino Uno
  14.     - Source Code created on: 2023-12-01 13:04:52
  15.     - Source Code generated by: G.MURUGARAJ
  16.  
  17. ********* Pleasedontcode.com **********/
  18. /****** DEFINITION OF LIBRARIES *****/
  19. #include <Arduino.h>
  20. #include <EasyButton.h>
  21.  
  22. /****** SYSTEM REQUIREMENT 1 *****/
  23. /* fan speed controlled by the temperature level */
  24.  
  25. /****** SYSTEM REQUIREMENT 2 *****/
  26. /* fan speed controlled by the temperature level */
  27.  
  28. /****** FUNCTION PROTOTYPES *****/
  29. void setup(void);
  30. void loop(void);
  31.  
  32. /***** DEFINITION OF DIGITAL INPUT PINS *****/
  33. const uint8_t fan_PushButton_PIN_D2 = 2;
  34.  
  35. /****** DEFINITION OF LIBRARIES CLASS INSTANCES*****/
  36. EasyButton fanPushButton(fan_PushButton_PIN_D2);
  37.  
  38. void setup(void)
  39. {
  40.   // put your setup code here, to run once:
  41.  
  42.   pinMode(fan_PushButton_PIN_D2, INPUT_PULLUP);
  43.  
  44.   // Initialize the fan push button
  45.   fanPushButton.begin();
  46. }
  47.  
  48. void loop(void)
  49. {
  50.   // put your main code here, to run repeatedly:
  51.  
  52.   // Read the fan push button state
  53.   fanPushButton.read();
  54.  
  55.   // Check if the fan push button is pressed
  56.   if (fanPushButton.isPressed())
  57.   {
  58.     // Perform the desired action when the fan push button is pressed
  59.     // ...
  60.   }
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement