#include <Wire.h>
#include <LiquidCrystal_I2C.h>
// Set the LCD address to 0x27 for a 16 chars and 2 line display
LiquidCrystal_I2C lcd(0x27,20,4);
#define BUTTON1KG 2 //1kg
#define BUTTON3KG 3 // 3kg
#define BUTTON5KG 4 // 3kg
#define ROTATION 5 // 3kg
#define RELAYSHREDDER 7
#define RELAYMIXER 6
void setup()
{
// initialize the LCD
lcd.begin(20,4,LCD_5x8DOTS);
// Turn on the blacklight and print a message.
lcd.backlight();
pinMode(RELAYSHREDDER, OUTPUT);
pinMode(ROTATION, OUTPUT);
pinMode(RELAYMIXER, OUTPUT);
pinMode(BUTTON1KG, INPUT_PULLUP); // Configure the first button as input with pull-up resistor
pinMode(BUTTON3KG, INPUT_PULLUP); // Configure the second button as input with pull-up resistor
pinMode(BUTTON5KG, INPUT_PULLUP); // Configure the second button as input with pull-up resistor
lcd.setCursor(2, 1);
lcd.print("This Project is");
lcd.setCursor(0, 2);
lcd.print("Presented to you by:");
lcd.setCursor(6, 2);
//lcd.print("GROUP 4");
delay(3000);
//lcd.setCursor(0, 3);
//lcd.print("Team Members:");
//delay(1000);
//String names[] = {"Georgia", "Earon", "Jayr", "Irish", "Nicole", "Rhogiet"};
//for (int i = 0; i < 6; i++) {
//lcd.setCursor(13, 3);
//lcd.print(names[i]);
//delay(1000);
//lcd.setCursor(13, 3);
// lcd.print(" "); // clear the line
// }
lcd.clear(); // clear the entire display
lcd.setCursor(6, 0);
lcd.print("GROUP 4");
lcd.setCursor(0, 1);
lcd.print("GEORGIA");
lcd.setCursor(0, 2);
lcd.print("RHOGIETT");
lcd.setCursor(0, 3);
lcd.print("WILFREDO");
lcd.setCursor(13, 1);
lcd.print("EARON");
lcd.setCursor(13, 2);
lcd.print("IRISH");
lcd.setCursor(13, 3);
lcd.print("NICOLE");
delay(5000);
lcd.clear(); // clear the entire display
lcd.setCursor(1, 0);
lcd.print("Automated Compost");
lcd.setCursor(7, 1);
lcd.print("System");
}
void loop() {
if (digitalRead(BUTTON1KG) == HIGH) {
digitalWrite(RELAYSHREDDER, HIGH); // turn on the relay to activate the SHREDDER
delay(1000); //run for 1 minutes
digitalWrite(RELAYSHREDDER, LOW); // turn off the relay to deactivate the SHREDDER
delay(2000); // wait for 30 seconds
digitalWrite(RELAYMIXER, HIGH); // turn on the relay to activate the MIXER (for every 5 minutes the mixer will turn on and off)
delay(5000); // wait for 10 seconds
digitalWrite(RELAYMIXER, LOW); // turn off the relay to deactivate the MIXER
delay(2000); // wait for another 10 seconds
digitalWrite(ROTATION, HIGH); // turn on the relay to activate the SHREDDER
delay(2000); //run for 1 minutes
digitalWrite(ROTATION, LOW); // turn off the relay to deactivate the SHREDDER
delay(2000); // wait for 30 seconds
}
if (digitalRead(BUTTON3KG) == HIGH) {
digitalWrite(RELAYSHREDDER, HIGH); // turn on the relay to activate the SHREDDER
delay(1000); //run for 1 minutes
digitalWrite(RELAYSHREDDER, LOW); // turn off the relay to deactivate the SHREDDER
delay(2000); // wait for 30 seconds
digitalWrite(RELAYMIXER, HIGH); // turn on the relay to activate the MIXER (for every 5 minutes the mixer will turn on and off)
delay(5000); // wait for 10 seconds
digitalWrite(RELAYMIXER, LOW); // turn off the relay to deactivate the MIXER
delay(2000); // wait for another 10 seconds
digitalWrite(ROTATION, HIGH); // turn on the relay to activate the SHREDDER
delay(2000); //run for 1 minutes
digitalWrite(ROTATION, LOW); // turn off the relay to deactivate the SHREDDER
delay(2000); // wait for 30 seconds
}
if (digitalRead(BUTTON5KG) == HIGH) {
digitalWrite(RELAYSHREDDER, HIGH); // turn on the relay to activate the SHREDDER
delay(1000); //run for 1 minutes
digitalWrite(RELAYSHREDDER, LOW); // turn off the relay to deactivate the SHREDDER
delay(2000); // wait for 30 seconds
digitalWrite(RELAYMIXER, HIGH); // turn on the relay to activate the MIXER (for every 5 minutes the mixer will turn on and off)
delay(5000); // wait for 10 seconds
digitalWrite(RELAYMIXER, LOW); // turn off the relay to deactivate the MIXER
delay(2000); // wait for another 10 seconds
digitalWrite(ROTATION, HIGH); // turn on the relay to activate the SHREDDER
delay(2000); //run for 1 minutes
digitalWrite(ROTATION, LOW); // turn off the relay to deactivate the SHREDDER
delay(2000); // wait for 30 seconds
}
else {
// if the button is not pressed, turn off both the shredder and the mixer
digitalWrite(RELAYSHREDDER, HIGH);
digitalWrite(RELAYMIXER, HIGH);
digitalWrite(ROTATION, HIGH);
}
}