Advertisement
alphauser420

7 segment

Oct 15th, 2023
8
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. from time import sleep
  2. import tm1637
  3.  
  4. try:
  5. import thread
  6. except ImportError:
  7. import _thread as thread
  8.  
  9. # Initialize the clock (GND, VCC=3.3V, Example Pins are DIO -20 and CLK21)
  10. Display = tm1637.TM1637(CLK=21, DIO=20, brightness=1.0)
  11. try:
  12. print ("Starting clock in the background (press CTRL + C to stop):")
  13. Display.StartClock(military_time=True)
  14. Display.SetBrightness(1.0)
  15. while True:
  16. Display.ShowDoublepoint(True)
  17. sleep(1)
  18. Display.ShowDoublepoint(False)
  19. sleep(1)
  20. Display.StopClock()
  21. thread.interrupt_main()
  22. except KeyboardInterrupt:
  23. print ("Properly closing the clock and open GPIO pins")
  24. Display.cleanup()
  25.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement