vsergeev / python-periphery

A pure Python 2/3 library for peripheral I/O (GPIO, LED, PWM, SPI, I2C, MMIO, Serial) in Linux.
MIT License
519 stars 139 forks source link

Frequency problems with PWM signals #57

Open rsnaet opened 1 year ago

rsnaet commented 1 year ago

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.