Advertisement
pleasedontcode

Button Functions rev_02

Dec 10th, 2023
71
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: Button Functions
  13.     - Source Code compiled for: Arduino Pro Mini 5V
  14.     - Source Code created on: 2023-12-10 11:19:06
  15.  
  16. ********* Pleasedontcode.com **********/
  17.  
  18. /****** SYSTEM REQUIREMENTS *****/
  19. /****** SYSTEM REQUIREMENT 1 *****/
  20.     /* generate an ai code to create a form to  fill name */
  21.     /* and age in python */
  22. /****** SYSTEM REQUIREMENT 2 *****/
  23.     /* print hellow code for python */
  24. /****** END SYSTEM REQUIREMENTS *****/
  25.  
  26. /****** DEFINITION OF LIBRARIES *****/
  27. #include <Arduino.h>
  28. #include <EasyButton.h>
  29.  
  30. /****** FUNCTION PROTOTYPES *****/
  31. void setup(void);
  32. void loop(void);
  33. void fillFormPythonCode(void);
  34. void printHelloWorldPythonCode(void);
  35.  
  36. /***** DEFINITION OF DIGITAL INPUT PINS *****/
  37. const uint8_t ak_PushButton_PIN_D2 = 2;
  38. const uint8_t ak_PushButton_PIN_D3 = 3;
  39.  
  40. /****** DEFINITION OF LIBRARY CLASS INSTANCES*****/
  41. EasyButton button1(ak_PushButton_PIN_D2);
  42. EasyButton button2(ak_PushButton_PIN_D3);
  43.  
  44. void setup(void)
  45. {
  46.   // put your setup code here, to run once:
  47.   button1.begin();
  48.   button2.begin();
  49.   // Configure pinMode and pull-up resistors for button pins if needed.
  50.   // pinMode(ak_PushButton_PIN_D2,  INPUT_PULLUP);
  51.   // pinMode(ak_PushButton_PIN_D3,  INPUT_PULLUP);
  52. }
  53.  
  54. void loop(void)
  55. {
  56.   // put your main code here, to run repeatedly:
  57.   button1.read();
  58.   button2.read();
  59.  
  60.   if (button1.isPressed())
  61.   {
  62.     // Code to be executed when button1 is pressed
  63.     fillFormPythonCode();
  64.     printHelloWorldPythonCode();
  65.   }
  66.  
  67.   if (button2.isPressed())
  68.   {
  69.     // Code to be executed when button2 is pressed
  70.     printHelloWorldPythonCode();
  71.   }
  72. }
  73.  
  74. void fillFormPythonCode(void)
  75. {
  76.   // Generate AI code to create a form to fill the name and age in Python
  77.   // Add your code here
  78. }
  79.  
  80. void printHelloWorldPythonCode(void)
  81. {
  82.   // Print "Hello World!" code for Python
  83.   // Add your code here
  84. }
  85.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement