GPIO Python library - periphery

I’m running DietPi on my RockPis and I find it is fantastic.
However, I cannot install libmraa
Anybody tried periphery?
So far I am able to get the LED and GPIO to work but I am having problems with PWM.
Below is what I was able to get working with the LED and GPIO:

from periphery import LED, GPIO, PWM
led0 = LED(“rockpis:green:power”, True)
led1 = LED(“rockpis:blue:user”, True)
gpio_out = GPIO(80, “out”) # ‘80’ is the GPIO number They all work.

The example for PWM does not work and can’t figure it out, it gives “OSError: [Errno 19] No such device”.
The documentation shows it requires two Parameters:

  • chip (int ) – PWM chip number.
  • channel (int ) – PWM channel number.

While the GPIO is asking for:

  • line (int) – GPIO line number.
  • direction (str) – GPIO direction, can be “in”, “out”, “high”, or “low”,

It would be great to have it working for my new project, I really don’t want to install an Arduino to take care of this…

It’s 3AM but I figured it out!
chip (int ) – PWM chip number <- this is the PWM number: the Rock Pis has two, PWM2 and PWM3.
So for PWM2 I just changed it to pwm = PWM(2, 0) and it works!
For PWM3 it would be pwm = PWM(3, 0)
Of course I had to enable PWM as described here: https://wiki.radxa.com/RockpiS/dev/libmraa

I’m happy I got it to work. Whooo hooo!!!