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 Navigation" - Source Code NOT compiled for: Arduino Uno - Source Code created on: 2024-06-07 10:38:30 ********* Pleasedontcode.com **********/ /****** SYSTEM REQUIREMENTS *****/ /****** SYSTEM REQUIREMENT 1 *****/ /* lcd display i2c 20x4 button pin11 UP LOW menu up */ /* button pin10 UP LOW menu enter button pin12UP LOW */ /* menu down MaxTemp ->max_temp -= 1.0; */ /* MinTeamp->min_temp -= 1.0; MaxFlow ->max_flow -= */ /* 1.0; MinFlow ->min_flow -= 1.0; */ /****** END SYSTEM REQUIREMENTS *****/ /****** DEFINITION OF LIBRARIES *****/ #include
#include
//https://github.com/marcoschwartz/LiquidCrystal_I2C /****** FUNCTION PROTOTYPES *****/ void setup(void); void loop(void); /***** DEFINITION OF DIGITAL INPUT PINS *****/ const uint8_t UP_BUTTON_PushButton_PIN_D11 = 11; const uint8_t DOWN_BUTTON_PushButton_PIN_D12 = 12; const uint8_t ENTER_BUTTON_PushButton_PIN_D10 = 10; /****** DEFINITION OF LIBRARIES CLASS INSTANCES*****/ LiquidCrystal_I2C lcd(0x27, 20, 4); // set the LCD address to 0x27 for a 20 chars and 4 line display /****** GLOBAL VARIABLES *****/ float max_temp = 100.0; float min_temp = 0.0; float max_flow = 100.0; float min_flow = 0.0; int menu_index = 0; void setup(void) { // put your setup code here, to run once: pinMode(UP_BUTTON_PushButton_PIN_D11, INPUT_PULLUP); pinMode(DOWN_BUTTON_PushButton_PIN_D12, INPUT_PULLUP); pinMode(ENTER_BUTTON_PushButton_PIN_D10, INPUT_PULLUP); // Initialize the LCD lcd.init(); lcd.backlight(); // Display a welcome message lcd.setCursor(3, 0); lcd.print("Hello, world!"); lcd.setCursor(2, 1); lcd.print("Ywrobot Arduino!"); lcd.setCursor(0, 2); lcd.print("Arduino LCM IIC 2004"); lcd.setCursor(2, 3); lcd.print("Power By Ec-yuan!"); delay(2000); // Display the welcome message for 2 seconds lcd.clear(); } void loop(void) { // put your main code here, to run repeatedly: if (digitalRead(UP_BUTTON_PushButton_PIN_D11) == LOW) { menu_index--; if (menu_index < 0) menu_index = 3; delay(200); // Debounce delay } if (digitalRead(DOWN_BUTTON_PushButton_PIN_D12) == LOW) { menu_index++; if (menu_index > 3) menu_index = 0; delay(200); // Debounce delay } if (digitalRead(ENTER_BUTTON_PushButton_PIN_D10) == LOW) { switch (menu_index) { case 0: max_temp -= 1.0; break; case 1: min_temp -= 1.0; break; case 2: max_flow -= 1.0; break; case 3: min_flow -= 1.0; break; } delay(200); // Debounce delay } // Display the current menu and values lcd.clear(); switch (menu_index) { case 0: lcd.setCursor(0, 0); lcd.print("MaxTemp: "); lcd.print(max_temp); break; case 1: lcd.setCursor(0, 0); lcd.print("MinTemp: "); lcd.print(min_temp); break; case 2: lcd.setCursor(0, 0); lcd.print("MaxFlow: "); lcd.print(max_flow); break; case 3: lcd.setCursor(0, 0); lcd.print("MinFlow: "); lcd.print(min_flow); break; } delay(100); // Small delay to avoid flickering } /* END CODE */
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)