Charlie_Lee_Rhee

Untitled

Sep 13th, 2016
327
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. #include <LiquidCrystal.h>;
  2. /**********************************************************/
  3. int b, a, c;
  4. int tim = 1000;
  5. // initialize the library with the numbers of the interface pins
  6. LiquidCrystal lcd(4, 6, 10, 11, 12, 13);
  7. /*********************************************************/
  8. void setup()
  9. {
  10. lcd.begin(16, 2); // set up the LCD's number of columns and rows:
  11. }
  12. /*********************************************************/
  13. void loop()
  14. {
  15. lcd.setCursor(1,0);
  16. lcd.print("tutorial45.com");
  17. lcd.setCursor(6,1);
  18. lcd.print(":");
  19. lcd.setCursor(9,1);
  20. lcd.print(":");
  21.  
  22. for (int h=23; h<-1; h--)
  23. for (int m=59; m<-1; m--)
  24. for (int s=59; s<-1; s--)
  25. {
  26. a=4;// Position for hours
  27. b=7;// Position for minutes
  28. c=10;// Position for seconds
  29. if (s<10) // add a zero before the digit of second when it is lower than 10
  30. {
  31. c=c+1;
  32. lcd.setCursor(c-1,1);
  33. lcd.print("0");
  34. }
  35. if (m<10) // add a zero before the digit of second when it is lower than 10
  36. {
  37. b=b+1;
  38. lcd.setCursor(b-1,1);
  39. lcd.print("0");
  40. }
  41. if (h<10) // shift the position of hours to one position when it is lower than 10
  42. {
  43. a=a+1;
  44. }
  45. lcd.setCursor(a,1);
  46. lcd.print(h);
  47. lcd.setCursor(b,1);
  48. lcd.print(m);
  49. lcd.setCursor(c,1);
  50. lcd.print(s);
  51. delay(tim); //wait for 1 second
  52. }
  53.  
  54. }
  55. /************************************************************
Advertisement
Add Comment
Please, Sign In to add comment