Advertisement
Guest User

countdown.py

a guest
Aug 25th, 2016
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.62 KB | None | 0 0
  1. #!/usr/bin/python
  2. # by Owen Allpress
  3.  
  4. import dothat.backlight as backlight
  5. import dothat.lcd as lcd
  6. import time
  7.  
  8. def countdown(count):
  9.     while (count >= 1):
  10.         lcd.clear()
  11.         lcd.set_cursor_position(2, 0)
  12.         lcd.set_contrast(45)
  13.         lcd.write("Torch off in:")
  14.         backlight.set_graph(1)
  15.         lcd.set_cursor_position(8, 2)
  16.         backlight.rgb(150, 150, 150)
  17.         lcd.write(str(count))
  18.         count -= 1
  19.         time.sleep(1)
  20.  
  21. countdown(10)
  22. lcd.clear()
  23. lcd.set_cursor_position(4, 1)
  24. backlight.set_graph(0)
  25. lcd.write ("Good bye!")
  26. time.sleep(2)
  27. lcd.clear()
  28. backlight.off()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement