timer_tests.py

# Dieses Werk ist unter der MIT-Lizenz lizenziert.
# Copyright (c) 2013-2023 OpenMV LLC. Alle Rechte vorbehalten.
# https://github.com/openmv/openmv/blob/master/LICENSE
#
# Beispiel für Timer-Test
#
# Dieses Beispiel testet alle Timer.

import time
from pyb import LED
from pyb import Timer

blue_led = LED(3)


# Hinweis: Funktionen, die Speicher zuweisen, sind in Callbacks nicht erlaubt
def tick(timer):
    blue_led.toggle()


print("")
for i in range(1, 18):
    try:
        print("Testing TIM%d... " % (i), end="")
        tim = Timer(i, freq=10, callback=tick)
        time.sleep_ms(1000)
        tim.deinit()
    except ValueError as e:
        print(e)
        continue
    print("done!")

results matching ""

    No results matching ""