/********* 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: Washing Controller
- Source Code NOT compiled for: Arduino Uno
- Source Code created on: 2024-10-22 02:31:08
********* Pleasedontcode.com **********/
/****** SYSTEM REQUIREMENTS *****/
/****** SYSTEM REQUIREMENT 1 *****/
/* 1- When you press the start button, it says on the */
/* screen that the wash has started 2- Wait 1 */
/* second and close the door 3- Wait 1 second and */
/* open the water valve and write that on the screen */
/* Then t */
/****** 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 START_BUTTON_PIN_A0 = A0;
const uint8_t STOP_BUTTON_PIN_A1 = A1;
const uint8_t WATER_LEVEL_PIN_A2 = A2;
/***** DEFINITION OF I2C PINS *****/
const uint8_t Lcd_LCD1602I2C_I2C_PIN_SDA_A4 = A4;
const uint8_t Lcd_LCD1602I2C_I2C_PIN_SCL_A5 = A5;
const uint8_t Lcd_LCD1602I2C_I2C_SLAVE_ADDRESS = 39;
/****** DEFINITION OF LIBRARIES CLASS INSTANCES *****/
// Initialize the LiquidCrystal_I2C object with the I2C address and dimensions
LiquidCrystal_I2C lcd(Lcd_LCD1602I2C_I2C_SLAVE_ADDRESS, 20, 4); // 20 columns and 4 rows
void setup(void)
{
// Initialize the LCD
lcd.init(); // Initialize the LCD
lcd.backlight(); // Turn on the backlight
// Set up pin modes for buttons and water level sensor
pinMode(START_BUTTON_PIN_A0, INPUT_PULLUP);
pinMode(STOP_BUTTON_PIN_A1, INPUT_PULLUP);
pinMode(WATER_LEVEL_PIN_A2, INPUT);
// Display initial messages on the LCD
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!");
}
void loop(void)
{
// Check if the start button is pressed
if (digitalRead(START_BUTTON_PIN_A0) == LOW) // Button pressed
{
// Indicate that the wash has started
lcd.clear(); // Clear the LCD
lcd.setCursor(0, 0);
lcd.print("Wash Started!"); // Display wash started message
delay(1000); // Wait for 1 second
// Close the door (simulated)
lcd.setCursor(0, 1);
lcd.print("Closing Door..."); // Display closing door message
delay(1000); // Wait for 1 second
// Open the water valve
lcd.setCursor(0, 2);
lcd.print("Opening Valve..."); // Display opening valve message
delay(1000); // Wait for 1 second
// Indicate that the water valve is open
lcd.setCursor(0, 3);
lcd.print("Water Valve Open"); // Display water valve open message
}
}
/* END CODE */