Advertisement
pleasedontcode

"Digital Setup" rev_01

Jan 28th, 2024
79
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: "Digital Setup"
  13.     - Source Code compiled for: Arduino Nano
  14.     - Source Code created on: 2024-01-28 15:43:57
  15.  
  16. ********* Pleasedontcode.com **********/
  17.  
  18. /****** SYSTEM REQUIREMENTS *****/
  19. /****** SYSTEM REQUIREMENT 1 *****/
  20.     /* On LCD1602_LCD1602I2C_I2C in the first line, show */
  21.     /* the value "1000 PLN" and give it a name: bank RED. */
  22.     /* On LCD1602_LCD1602I2C_I2C in the second line show */
  23.     /* the value "1000 PLN" and give it a name: */
  24.     /* bankZOLTY. */
  25. /****** END SYSTEM REQUIREMENTS *****/
  26.  
  27. /****** DEFINITION OF LIBRARIES *****/
  28. #include <Arduino.h>
  29. #include <Wire.h>
  30. #include <EasyButton.h>
  31. #include <LiquidCrystal_I2C.h>
  32.  
  33. /************************************************************************
  34.  * FUNCTION PROTOTYPES
  35.  ************************************************************************/
  36. void setup(void);
  37. void loop(void);
  38.  
  39. /************************************************************************
  40.  * DEFINITION OF DIGITAL INPUT PINS
  41.  ************************************************************************/
  42. const uint8_t zielonyP_PushButton_PIN_D2 = 2;
  43. const uint8_t czerwonyP_PushButton_PIN_D3 = 3;
  44.  
  45. /************************************************************************
  46.  * DEFINITION OF DIGITAL OUTPUT PINS
  47.  ************************************************************************/
  48. const uint8_t ledZ_LED_PIN_D4 = 4;
  49. const uint8_t ledC_LED_PIN_D5 = 5;
  50.  
  51. /************************************************************************
  52.  * DEFINITION OF I2C PINS
  53.  ************************************************************************/
  54. const uint8_t LCD1602_LCD1602I2C_I2C_PIN_SDA_A4 = A4;
  55. const uint8_t LCD1602_LCD1602I2C_I2C_PIN_SCL_A5 = A5;
  56. const uint8_t LCD1602_LCD1602I2C_I2C_SLAVE_ADDRESS = 0x27;
  57.  
  58. /************************************************************************
  59.  * DEFINITION OF LIBRARY CLASS INSTANCES
  60.  ************************************************************************/
  61. EasyButton zielonyP_PushButton(zielonyP_PushButton_PIN_D2);
  62. EasyButton czerwonyP_PushButton(czerwonyP_PushButton_PIN_D3);
  63. LiquidCrystal_I2C lcd(LCD1602_LCD1602I2C_I2C_SLAVE_ADDRESS, 16, 2);
  64.  
  65. void setup(void)
  66. {
  67.   // Configure digital input pins
  68.   pinMode(zielonyP_PushButton_PIN_D2, INPUT_PULLUP);
  69.   pinMode(czerwonyP_PushButton_PIN_D3, INPUT_PULLUP);
  70.  
  71.   // Configure digital output pins
  72.   pinMode(ledZ_LED_PIN_D4, OUTPUT);
  73.   pinMode(ledC_LED_PIN_D5, OUTPUT);
  74.  
  75.   // Initialize EasyButton instances
  76.   zielonyP_PushButton.begin();
  77.   czerwonyP_PushButton.begin();
  78.  
  79.   // Initialize LCD display
  80.   lcd.begin(16, 2);
  81.   lcd.backlight();
  82.  
  83.   // Show "1000 PLN" on the first line of the LCD and give it a name: bank RED
  84.   lcd.setCursor(0, 0);
  85.   lcd.print("bank RED: 1000 PLN");
  86.  
  87.   // Show "1000 PLN" on the second line of the LCD and give it a name: bankZOLTY
  88.   lcd.setCursor(0, 1);
  89.   lcd.print("bankZOLTY: 1000 PLN");
  90. }
  91.  
  92. void loop(void)
  93. {
  94.   // Read button states
  95.   zielonyP_PushButton.read();
  96.   czerwonyP_PushButton.read();
  97. }
  98. /************************************************************************
  99.  * END OF CODE
  100.  ************************************************************************/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement