steering gear

    caveat!Please use an external power supply, do not use a computer to supply power to the steering gear.


    The steering gear needs to use PWM output with different duty ratios to control its rotation angle. First, you need to prepare the steering gear

    • Import the PWM module, create a PWM object, and connect the PWM output pin to the servo signal input
    from machine import Timer,PWM
    tim = Timer(Timer.TIMER0, Timer.CHANNEL0, mode=Timer.MODE_PWM)
    S1 = PWM(tim, freq=50, duty=0, pin=17)
    • Output different duty cycle waveforms to control the servo

    PWM control API reference: PWM API


    • Control the servo to rotate at different angles: Servo

    • Servo pan/tilt: gimbal