python-periphery icon indicating copy to clipboard operation
python-periphery copied to clipboard

Frequency problems with PWM signals

Open rsnaet opened this issue 2 years ago • 0 comments

Hey,

I am having an issues using the PWM code in Visual Studio Code (Python), I am using an Asus Tinker Edge R. When I run the code, I can only use a frequency of 1Hz. All other values give "OSError: [Errno 22] Invalid argument", it does not matter if I set the frequency to 0.1 or to 1e3. The problem stays the same. How can I fix this?

    from periphery import PWM
    
    Chip = 1        #Chip1, Channel0 is PWM pin 33
    Channel = 0
    
    pwm = PWM(Chip, Channel)  
    pwm.frequency = 1
    print('freq set')
    pwm.duty_cycle=0.5
    print('duty cycle set')
    pwm.enable()

With kind regards.

rsnaet avatar Sep 30 '22 07:09 rsnaet