Advertisement
pleasedontcode

Button Display rev_02

Jan 28th, 2024
82
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 Display
  13.     - Source Code compiled for: Arduino Nano
  14.     - Source Code created on: 2024-01-28 15:50:28
  15.  
  16. ********* Pleasedontcode.com **********/
  17.  
  18. /****** SYSTEM REQUIREMENTS *****/
  19. /****** SYSTEM REQUIREMENT 1 *****/
  20.     /* On LCD1602_LCD1602I2C_I2C display two values,   in */
  21.     /* the first line, type: 1000 PLN  in the second */
  22.     /* line, type: 1000 PLN */
  23. /****** END SYSTEM REQUIREMENTS *****/
  24.  
  25. /****** DEFINITION OF LIBRARIES *****/
  26. #include <Arduino.h>
  27. #include <Wire.h>
  28. #include <EasyButton.h>
  29. #include <LiquidCrystal_I2C.h>
  30.  
  31. /****** SYSTEM REQUIREMENTS *****/
  32.  
  33. /****** SYSTEM REQUIREMENT 1 *****/
  34. const uint8_t LCD1602_LCD1602I2C_I2C_PIN_SDA_A4 = A4;
  35. const uint8_t LCD1602_LCD1602I2C_I2C_PIN_SCL_A5 = A5;
  36. const uint8_t LCD1602_LCD1602I2C_I2C_SLAVE_ADDRESS = 0x27;
  37.  
  38. /****** FUNCTION PROTOTYPES *****/
  39. void setup(void);
  40. void loop(void);
  41.  
  42. /***** DEFINITION OF DIGITAL INPUT PINS *****/
  43. const uint8_t zielonyP_PushButton_PIN_D2 = 2;
  44. const uint8_t czerwonyP_PushButton_PIN_D3 = 3;
  45.  
  46. /****** DEFINITION OF LIBRARIES CLASS INSTANCES*****/
  47.  
  48. EasyButton zielonyP_PushButton(zielonyP_PushButton_PIN_D2);
  49. EasyButton czerwonyP_PushButton(czerwonyP_PushButton_PIN_D3);
  50.  
  51. LiquidCrystal_I2C lcd(LCD1602_LCD1602I2C_I2C_SLAVE_ADDRESS, 16, 2); // Modify the initialization here
  52.  
  53. void setup(void)
  54. {
  55.   // put your setup code here, to run once:
  56.  
  57.   pinMode(zielonyP_PushButton_PIN_D2, INPUT_PULLUP);
  58.   pinMode(czerwonyP_PushButton_PIN_D3, INPUT_PULLUP);
  59.  
  60.   zielonyP_PushButton.begin();
  61.   czerwonyP_PushButton.begin();
  62.  
  63.   lcd.init(); // Initialize the LCD module
  64.   lcd.backlight(); // Turn on the backlight
  65.  
  66.   lcd.setCursor(0, 0);
  67.   lcd.print("1000 PLN");
  68.   lcd.setCursor(0, 1);
  69.   lcd.print("1000 PLN");
  70. }
  71.  
  72. void loop(void)
  73. {
  74.   // put your main code here, to run repeatedly:
  75.  
  76.   zielonyP_PushButton.read();
  77.   czerwonyP_PushButton.read();
  78. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement