0

I am trying to configure two pins on Raspberry pi 4 with different frequencies (one being half of the other). How can I do that?

Thanks in advance

2
  • What frequencies? What dutycycle? What accuracy? – joan Jan 12 at 10:39
  • @joan One using 10Hz and the other using 20Hz. With duty cycle 50%. – Raquel Alves Jan 12 at 10:55
0

You can do that with pigpio using any of GPIO 0-31.

As an example using GPIO 5 and 6.

sudo pigpiod # start the pigpio daemon

pigs pfs 5 10 # set GPIO 5 to 10 Hz frequency
pigs pfs 6 20 # set GPIO 6 to 20 Hz frequency

pigs p 5 128 # 128/256 square wave
pigs p 6 128 # 128/256 square wave

pigs pfs pigs p

enter image description here

C

gpioPWM

gpioSetPWMfrequency

Python

set_PWM_dutycycle

set_PWM_frequency

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.