Advertisement
pleasedontcode

Test rev_01

Dec 5th, 2023
96
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: Test
  13.     - Source Code compiled for: Arduino Pro Mini 5V
  14.     - Source Code created on: 2023-12-06 00:15:03
  15.     - Source Code generated by: Neuro
  16.  
  17. ********* Pleasedontcode.com **********/
  18.  
  19. /****** SYSTEM REQUIREMENTS *****/
  20. /****** SYSTEM REQUIREMENT 1 *****/
  21.     /* Multiply 18 by 19, when pressing a pushbutton */
  22. /****** END SYSTEM REQUIREMENTS *****/
  23.  
  24. /****** DEFINITION OF LIBRARIES *****/
  25. #include <Arduino.h>
  26. #include <EasyButton.h>
  27.  
  28. /******************************************************************
  29. SYSTEM REQUIREMENTS
  30. ******************************************************************/
  31. // Multiply 18 by 19, when pressing a pushbutton
  32. const int multiplicationFactor = 18 * 19;
  33.  
  34. /******************************************************************
  35. GLOBAL VARIABLES
  36. ******************************************************************/
  37. EasyButton button(2); // Button connected to digital pin 2
  38.  
  39. /******************************************************************
  40. FUNCTION PROTOTYPES
  41. ******************************************************************/
  42. void setup();
  43. void loop();
  44.  
  45. /******************************************************************
  46. SETUP FUNCTION
  47. ******************************************************************/
  48. void setup()
  49. {
  50.     // Set the pin mode of the push button
  51.     pinMode(2, INPUT_PULLUP);
  52.  
  53.     // Initialize the button object
  54.     button.begin();
  55. }
  56.  
  57. /******************************************************************
  58. LOOP FUNCTION
  59. ******************************************************************/
  60. void loop()
  61. {
  62.     // Read the button state
  63.     button.read();
  64.  
  65.     // Check if the button is pressed
  66.     if (button.isPressed())
  67.     {
  68.         // Perform the multiplication when the button is pressed
  69.         int result = multiplicationFactor;
  70.         Serial.print("Result: ");
  71.         Serial.println(result);
  72.     }
  73. }
  74.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement