pyb1.py 500 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. # basic tests of pyb module
  2. import pyb
  3. # test delay
  4. pyb.delay(-1)
  5. pyb.delay(0)
  6. pyb.delay(1)
  7. start = pyb.millis()
  8. pyb.delay(17)
  9. print((pyb.millis() - start) // 5) # should print 3
  10. # test udelay
  11. pyb.udelay(-1)
  12. pyb.udelay(0)
  13. pyb.udelay(1)
  14. start = pyb.millis()
  15. pyb.udelay(17000)
  16. print((pyb.millis() - start) // 5) # should print 3
  17. # other
  18. pyb.disable_irq()
  19. pyb.enable_irq()
  20. print(pyb.have_cdc())
  21. pyb.sync()
  22. print(len(pyb.unique_id()))
  23. pyb.wfi()
  24. pyb.fault_debug(True)
  25. pyb.fault_debug(False)