Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <LiquidCrystal.h>
- int buttonPin = 7;
- int ledPin = 13;
- int buttonState = 0;
- boolean on = false;
- int flag = 0;
- int S = 05; // count seconds
- int M = 00; // count minutes
- int H = 00; // count hours
- //initialize the library with the numbers of the interface pins
- LiquidCrystal lcd(12, 11, 5, 4, 3, 2); // pins connected to LCD
- void setup()
- {
- pinMode(ledPin, OUTPUT);
- pinMode(buttonPin, INPUT);
- lcd.begin(16, 2);
- lcd.clear();
- }
- void loop() {
- buttonState = digitalRead(buttonPin);
- timeOut = (H == 0 && M == 0 && S == 0)
- on = (buttonState == HIGH) ? true : false;
- currentState = (on == true && timeOut) ? LOW : HIGH
- digitalWrite(ledPin, currentState);
- while (currentState == HIGH) {
- S = S - 1
- lcd.setCursor(1,0);
- lcd.print("Remaining");
- lcd.setCursor(6,1);
- lcd.print(":");
- lcd.setCursor(9,1);
- lcd.print(":");
- delay(1000);
- if (S == 0) {
- M--;
- S = 05;
- }
- if (M == 0) {
- H--;
- M = 00;
- }
- if (H == 0) {
- H = 00;
- M = 00;
- S = 05;
- }
- }
- lcd.clear();
- lcd.display();
- lcd.setCursor(0,0);
- lcd.print("Your laundry is ");
- lcd.setCursor(4,1);
- lcd.print("DONE!");
- delay(300);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement