0

Using pigpio, I can set the hardware PWM value but getting it seems to consistently give three of the old values, a zero and then the new value, as well as the old value returned with the initial command

>>> gpio.hardware_PWM(18, 10000, 10)
10000
>>> for i in range(7):
...     print(i, ' ', gpio.get_PWM_dutycycle(18))
... 
0   10000
1   10000
2   10000
3   0
4   10
5   10
6   10
>>> gpio.hardware_PWM(18, 10000, 100000)
10
>>> for i in range(7):
...     print(i, ' ', gpio.get_PWM_dutycycle(18))
... 
0   10
1   10
2   10
3   0
4   100000
5   100000
6   100000
>>> gpio.hardware_PWM(18, 10000, 1000)
100000
>>> for i in range(7):
...     print(i, ' ', gpio.get_PWM_dutycycle(18))
... 
0   100000
1   100000
2   100000
3   0
4   1000
5   1000
6   1000
0

I am not sure what you are doing.

These are my results.

>>> pi.hardware_PWM(18, 10000, 7733);pi.get_PWM_dutycycle(18)
0
7733
>>> pi.hardware_PWM(18, 10000, 72733);pi.get_PWM_dutycycle(18)
0
72733
>>> pi.hardware_PWM(18, 10000, 73);pi.get_PWM_dutycycle(18)
0
73
1
  • Thanks figured out it was my CLI session had backed up a few instances Jul 9 '20 at 11:29
0

Turns out the cli session I was testing in had multiple instances or something similar. Reboot fixed to look like Joan's answer

1
  • Please accept your own answer with a click on the tick on its left side. Only this will finish the question and it will not pop up again year for year.
    – Ingo
    Jul 11 '20 at 20:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.