Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /********* Pleasedontcode.com **********
- Pleasedontcode thanks you for automatic code generation! Enjoy your code!
- - Terms and Conditions:
- You have a non-exclusive, revocable, worldwide, royalty-free license
- for personal and commercial use. Attribution is optional; modifications
- are allowed, but you're responsible for code maintenance. We're not
- liable for any loss or damage. For full terms,
- please visit pleasedontcode.com/termsandconditions.
- - Project: "Button Game"
- - Source Code compiled for: Arduino Mega
- - Source Code created on: 2024-04-10 23:29:11
- ********* Pleasedontcode.com **********/
- /****** SYSTEM REQUIREMENTS *****/
- /****** SYSTEM REQUIREMENT 1 *****/
- /* button1=1 button2=2 button3=3 theres 2 players, */
- /* starts with player 1, when they push 3 buttons */
- /* their values are added up and displayed on the top */
- /* row on the LCD, then its player 2s turn when they */
- /* push 3 buttons their score gets added put on */
- /* bottom */
- /****** SYSTEM REQUIREMENT 2 *****/
- /* button1=1 button2=2 button3=3 theres 2 players, */
- /* starts with player 1, when they push 3 buttons */
- /* their values are added up and displayed on the top */
- /* row on the LCD, then its player 2s turn when they */
- /* push 3 buttons their score gets added put on */
- /* bottom */
- /****** END SYSTEM REQUIREMENTS *****/
- /****** DEFINITION OF LIBRARIES *****/
- #include <Wire.h>
- #include <EasyButton.h>
- #include <LiquidCrystal_I2C.h>
- /****** SYSTEM REQUIREMENTS *****/
- /****** SYSTEM REQUIREMENT 1 *****/
- /* button1=1 button2=2 button3=3 theres 2 players, */
- /* starts with player 1, when they push 3 buttons */
- /* their values are added up and displayed on the top */
- /* row on the LCD, then its player 2s turn when they */
- /* push 3 buttons their score gets added put on */
- /* bottom */
- /****** SYSTEM REQUIREMENT 2 *****/
- /* button1=1 button2=2 button3=3 theres 2 players, */
- /* starts with player 1, when they push 3 buttons */
- /* their values are added up and displayed on the top */
- /* row on the LCD, then its player 2s turn when they */
- /* push 3 buttons their score gets added put on */
- /* bottom */
- /****** END SYSTEM REQUIREMENTS *****/
- /****** FUNCTION PROTOTYPES *****/
- void setup(void);
- void loop(void);
- /***** DEFINITION OF DIGITAL INPUT PINS *****/
- const uint8_t Button1_PushButton_PIN_D2 = 2;
- const uint8_t Button2_PushButton_PIN_D4 = 4;
- const uint8_t Button3_PushButton_PIN_D3 = 3;
- /***** DEFINITION OF I2C PINS *****/
- const uint8_t LCD_LCD1602I2C_I2C_PIN_SDA_D20 = 20;
- const uint8_t LCD_LCD1602I2C_I2C_PIN_SCL_D21 = 21;
- const uint8_t LCD_LCD1602I2C_I2C_SLAVE_ADDRESS = 0x27;
- /****** DEFINITION OF LIBRARIES CLASS INSTANCES*****/
- EasyButton button1(Button1_PushButton_PIN_D2);
- EasyButton button2(Button2_PushButton_PIN_D4);
- EasyButton button3(Button3_PushButton_PIN_D3);
- LiquidCrystal_I2C lcd(LCD_LCD1602I2C_I2C_SLAVE_ADDRESS, LCD_LCD1602I2C_I2C_PIN_SDA_D20, LCD_LCD1602I2C_I2C_PIN_SCL_D21);
- void setup(void)
- {
- // put your setup code here, to run once:
- pinMode(Button1_PushButton_PIN_D2, INPUT_PULLUP);
- pinMode(Button2_PushButton_PIN_D4, INPUT_PULLUP);
- pinMode(Button3_PushButton_PIN_D3, INPUT_PULLUP);
- lcd.begin(16, 2);
- lcd.setBacklight(LOW);
- }
- void loop(void)
- {
- // put your main code here, to run repeatedly:
- button1.read();
- button2.read();
- button3.read();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement