0

I am using pigpio to read 4 inputs. Everything works fine. And the entire process is a bit long and memory consuming. I also have to use one PWM output. I am planning to use the hardware PWM (pin 12 or 33) of the raspberry pi. My doubt is, using pigpio and hardware PWM pin simultaneously is safe or not?

import pigpio
import Rpi.GPIO as HWPWM


#using pigpio for reading 4 pins

pigpio.exceptions = True
GPIO=[23, 24, 25, 26]
for pinNr in GPIO:
    pi.set_mode(pinNr, pigpio.INPUT)


#uisng hardware PWM to set a pin

HWPWM.setmode(HWPWM.BOARD)
HWPWM.setup(12, HWPWM.OUT)

pwm12 = HWPWM.PWM(12, 0.5)
#50% duty cycle
pwm12.start(50)


3
  • Not sure what you are doing there. You are trying to use RPi.GPIO to provide hardware PWM. RPi.GPIO has no support for hardware PWM. – joan Apr 19 '20 at 19:27
  • how to use hardware PWM? That is what I got from a website. – sunny_old_days Apr 20 '20 at 6:40
  • Try a different web-site? abyz.me.uk/rpi/pigpio/python.html#hardware_PWM – joan Apr 20 '20 at 7:54

Your Answer

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

Browse other questions tagged or ask your own question.