pwm_control.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 PWM-Steuerung
#
# Dieses Beispiel zeigt, wie PWM mit Ihrer OpenMV Cam durchgeführt wird.

import time
from pyb import Pin, Timer

tim = Timer(4, freq=1000)  # Frequenz in Hz
# Erzeugt eine 1-kHz-Rechteckwelle auf TIM4 mit 50 % bzw. 75 % Tastgrad auf Kanal 1 und 2.
ch1 = tim.channel(1, Timer.PWM, pin=Pin("P7"), pulse_width_percent=50)
ch2 = tim.channel(2, Timer.PWM, pin=Pin("P8"), pulse_width_percent=75)

while True:
    time.sleep_ms(1000)

results matching ""

    No results matching ""