1

I have a GPIO pin set up as a PWM. I would like to set up an interrupt every time the PWM signal goes high. Is there any way of doing it?

I tried mixing the pigpiod library and rpi library, but when I get the PWM to work through pigpiod and then use GPIO.wait_for_edge, it seems to overwrite the PWM functionality.

Thank you

1

As far as I am aware the RPi.GPIO module only allows interrupts and wait for edge on GPIO which are in mode INPUT. That means you can't use those features on a GPIO outputting PWM (e.g. a GPIO in mode PWM or mode OUTPUT).

pigpio will allow alerts and wait for edge on such GPIO.

3
  • 1
    Thank you, I'm thinking of an alternative solution
    – George
    Mar 2 '20 at 19:06
  • 1
    I tried using callback(user_gpio, edge, func), it seems to work but for some reason it get's out of the while loop, I've edited the post to show the code
    – George
    Mar 2 '20 at 20:09
  • 1
    Actually I'll start a new question
    – George
    Mar 2 '20 at 20:14

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.