SERVOMOTOR PARTE1

PARTE1: MONTAJE Realice en WOKWI el siguiente montaje virtual. El ejercicio es INDIVIDUAL Debe incluir el LOGO DE WOKWI y debe insertar su nombre tal como se indica en el modelo. Una vez realizado el montaje avise al profesor.
PARTE 2 ALGORITMO Copie y pegue el algoritmo, pero debe organizarlo de manera lógica. ''' JOHN F. KENNEDY D.E.I Created by: Date created: Date modified: Description: Estudio del SERVOMOTOR activado por potenciómetro. ''' #Libraries from machine import PWM, Pin, ADC import utime # VARIABLES DECLARATION #Potenciometer: Analog Digital Converter adc = ADC(2) #Servomotor s = PWM(Pin(0)) s.freq(50) #LOOP while True: potenciometer = int(adc.read_u16()*180/65535) print(potenciometer) #Time in ON ton=(potenciometer+45)*100000/9 s.duty_ns(int(ton)) utime.sleep_ms(200)

Comentarios

  1. '''
    JOHN F. KENNEDY
    Created by:
    Date created:
    Date modified:
    Description: Estudio del SERVOMOTOR activado por potenciómetro.
    '''

    # Libraries
    from machine import PWM, Pin, ADC
    import utime

    # Variables

    adc = ADC(2) # Lectura analógica en pin 2

    s = PWM(Pin(0))
    s.freq(50)

    # Loop while true
    while True:
    potenciometer = int(adc.read_u16() * 180 / 65535)
    print(potenciometer) # Imprimir el valor del ángulo

    ton = (potenciometer + 45) * 100000 / 9
    s.duty_ns(int(ton)) # Configura el tiempo de encendido del servomotor

    utime.sleep_ms(200)

    ResponderEliminar

Publicar un comentario

Entradas populares de este blog

SIMULATION ANALYSIS OF FINAL

LABORATORIES USING RASPBERRY PICO