wdt.py 540 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. '''
  2. WDT test for the CC3200 based boards
  3. '''
  4. from machine import WDT
  5. import time
  6. # test the invalid cases first
  7. try:
  8. wdt = WDT(1)
  9. except Exception:
  10. print("Exception")
  11. try:
  12. wdt = WDT(0, 500)
  13. except Exception:
  14. print("Exception")
  15. try:
  16. wdt = WDT(1, timeout=2000)
  17. except Exception:
  18. print("Exception")
  19. wdt = WDT(timeout=1000)
  20. print(wdt)
  21. try:
  22. wdt = WDT(0, timeout=2000)
  23. except Exception:
  24. print("Exception")
  25. time.sleep_ms(500)
  26. wdt.feed()
  27. print(wdt)
  28. time.sleep_ms(900)
  29. wdt.feed()
  30. print(wdt)
  31. time.sleep_ms(950)