Advertisement
pleasedontcode

Example rev_01

Nov 5th, 2023
111
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: Example
  13.     - Source Code compiled for: Arduino Uno
  14.     - Source Code created on: 2023-11-05 23:21:04
  15.     - Source Code generated by: Francesco
  16.  
  17. ********* Pleasedontcode.com **********/
  18. /****** DEFINITION OF LIBRARIES *****/
  19. #include <Arduino.h>
  20. #include <EasyButton.h>
  21.  
  22. #define BUTTON_PIN 2
  23.  
  24. EasyButton button(BUTTON_PIN);
  25.  
  26. void onPressed()
  27. {
  28.   Serial.println("Button pressed");
  29. }
  30.  
  31. void setup()
  32. {
  33.   Serial.begin(115200);
  34.   Serial.println();
  35.   Serial.println(">>> EasyButton pressed example <<<");
  36.  
  37.   button.begin();
  38.   button.onPressed(onPressed);
  39. }
  40.  
  41. void loop()
  42. {
  43.   button.read();
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement