Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
/********* 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 Display - Source Code compiled for: Arduino Uno - Source Code created on: 2024-02-19 09:23:15 ********* Pleasedontcode.com **********/ /****** SYSTEM REQUIREMENTS *****/ /****** SYSTEM REQUIREMENT 1 *****/ /* This code will arduino uno to 1602 I2C LCD. show */ /* initial message "Welcome to PES" in 1st line. */ /* "Charging Station" in 2nd line. after 5 seconds */ /* delay, show message "Press Button to" in 1st line. */ /* "Start Charging" in 2nd line. when momentary */ /* contact but */ /****** SYSTEM REQUIREMENT 2 *****/ /* This code will arduino uno to 1602 I2C LCD. show */ /* initial message "Welcome to PES" in 1st line. */ /* "Charging Station" in 2nd line. after 5 seconds */ /* delay, show message "Press Button to" in 1st line. */ /* "Start Charging" in 2nd line. when momentary */ /* contact but */ /****** END SYSTEM REQUIREMENTS *****/ /****** DEFINITION OF LIBRARIES *****/ #include
//https://github.com/evert-arias/EasyButton #include
// I2C communication library #include
// LCD library /****** FUNCTION PROTOTYPES *****/ void setup(void); void loop(void); /***** DEFINITION OF DIGITAL INPUT PINS *****/ const uint8_t Button_PushButton_PIN_D2 = 2; const uint8_t Button_PushButton_PIN_D3 = 3; /****** DEFINITION OF LCD PARAMETERS *****/ const int LCD_ADDRESS = 0x27; // I2C address of the LCD module const int LCD_COLUMNS = 16; // Number of columns in the LCD module const int LCD_ROWS = 2; // Number of rows in the LCD module /****** DEFINITION OF LIBRARIES CLASS INSTANCES *****/ EasyButton button1(Button_PushButton_PIN_D2); EasyButton button2(Button_PushButton_PIN_D3); LiquidCrystal_I2C lcd(LCD_ADDRESS, LCD_COLUMNS, LCD_ROWS); // Create an object for the LCD module void setup(void) { // put your setup code here, to run once: lcd.begin(LCD_COLUMNS, LCD_ROWS); // Initialize the LCD module lcd.print("Welcome to PES"); // Print the welcome message on the first line lcd.setCursor(0, 1); // Move the cursor to the second line lcd.print("Charging Station"); // Print the charging station message on the second line delay(5000); // Delay for 5 seconds lcd.clear(); // Clear the LCD screen lcd.print("Press Button to"); // Print the "Press Button to" message on the first line lcd.setCursor(0, 1); // Move the cursor to the second line lcd.print("Start Charging"); // Print the "Start Charging" message on the second line pinMode(Button_PushButton_PIN_D2, INPUT_PULLUP); pinMode(Button_PushButton_PIN_D3, INPUT_PULLUP); } void loop(void) { // put your main code here, to run repeatedly: button1.read(); // Read the state of button1 button2.read(); // Read the state of button2 // Check if button1 is pressed if (button1.isPressed()) { lcd.clear(); // Clear the LCD screen lcd.print("Button 1 Pressed"); // Print the button1 pressed message on the first line lcd.setCursor(0, 1); // Move the cursor to the second line lcd.print("Start Charging"); // Print the "Start Charging" message on the second line } // Check if button2 is pressed if (button2.isPressed()) { lcd.clear(); // Clear the LCD screen lcd.print("Button 2 Pressed"); // Print the button2 pressed message on the first line lcd.setCursor(0, 1); // Move the cursor to the second line lcd.print("Start Charging"); // Print the "Start Charging" message on the second line } }
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)