示例#1
0
    def test_timer(self):
        ct = cyber_timer.Timer(100, self.func, 0)  # 100ms
        ct.start()
        time.sleep(1)  # 1s
        ct.stop()

        print('+' * 40 + 'test set_option' + '+' * 40)
        ct2 = cyber_timer.Timer()  # 10ms
        ct2.set_option(100, self.func, 0)
        ct2.start()
        time.sleep(1)  # 1s
        ct2.stop()
示例#2
0
def test_timer():
    cyber.init()
    ct = cyber_timer.Timer(10, fun, 0)  # 10ms
    ct.start()
    time.sleep(1)  # 1s
    ct.stop()

    print("+" * 80, "test set_option")
    ct2 = cyber_timer.Timer()  # 10ms
    ct2.set_option(10, fun, 0)
    ct2.start()
    time.sleep(1)  # 1s
    ct2.stop()

    cyber.shutdown()