test.py 715 B

12345678910111213141516171819202122232425262728293031323334
  1. # import mywifi
  2. from machine import Timer
  3. # import esp_mqtt
  4. import struct
  5. import os
  6. import time
  7. import re
  8. class Client():
  9. def __init__(self):
  10. self.count = 0
  11. self.timer = Timer(0)
  12. self.timer.init(period=2000, mode=Timer.PERIODIC, callback=self.push)
  13. def push(self, timer):
  14. self.count += 1
  15. print("Client:", self.count)
  16. class Test():
  17. def __init__(self) -> None:
  18. self.count = 0
  19. self.timer = Timer(0)
  20. self.timer.init(period=2000, mode=Timer.PERIODIC, callback=self.publish_timer_callback)
  21. def publish_timer_callback(self, timer):
  22. self.count += 1
  23. print("Test:", self.count)
  24. t = Test()
  25. c= Client()