pwm_control.py

# Questo lavoro è concesso in licenza MIT.
# Copyright (c) 2013-2023 OpenMV LLC. Tutti i diritti riservati.
# https://github.com/openmv/openmv/blob/master/LICENSE
#
# Esempio di controllo PWM
#
# Questo esempio mostra come fare PWM con la tua OpenMV Cam.

import time
from pyb import Pin, Timer

tim = Timer(4, freq=1000)  # Frequenza in Hz
# Generare un'onda quadra a 1KHz su TIM4 con duty cycle rispettivamente del 50% e 75% sui canali 1 e 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 ""