Advertisement
Guest User

Untitled

a guest
May 24th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. #include <LiquidCrystal.h>
  2.  
  3. int buttonPin = 7;
  4. int ledPin = 13;
  5. int buttonState = 0;
  6. boolean on = false;
  7. int flag = 0;
  8. int S = 05; // count seconds
  9. int M = 00; // count minutes
  10. int H = 00; // count hours
  11. //initialize the library with the numbers of the interface pins
  12. LiquidCrystal lcd(12, 11, 5, 4, 3, 2); // pins connected to LCD
  13.  
  14. void setup()
  15. {
  16. pinMode(ledPin, OUTPUT);
  17. pinMode(buttonPin, INPUT);
  18. lcd.begin(16, 2);
  19. lcd.clear();
  20. }
  21.  
  22. void loop() {
  23. buttonState = digitalRead(buttonPin);
  24. timeOut = (H == 0 && M == 0 && S == 0)
  25. on = (buttonState == HIGH) ? true : false;
  26. currentState = (on == true && timeOut) ? LOW : HIGH
  27.  
  28. digitalWrite(ledPin, currentState);
  29.  
  30. while (currentState == HIGH) {
  31. S = S - 1
  32. lcd.setCursor(1,0);
  33. lcd.print("Remaining");
  34. lcd.setCursor(6,1);
  35. lcd.print(":");
  36. lcd.setCursor(9,1);
  37. lcd.print(":");
  38. delay(1000);
  39.  
  40. if (S == 0) {
  41. M--;
  42. S = 05;
  43. }
  44.  
  45. if (M == 0) {
  46. H--;
  47. M = 00;
  48. }
  49.  
  50. if (H == 0) {
  51. H = 00;
  52. M = 00;
  53. S = 05;
  54. }
  55. }
  56.  
  57. lcd.clear();
  58. lcd.display();
  59. lcd.setCursor(0,0);
  60. lcd.print("Your laundry is ");
  61. lcd.setCursor(4,1);
  62. lcd.print("DONE!");
  63. delay(300);
  64.  
  65. return 0;
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement