I've been working on a project using the Pi ... I need to give PWM output but every one says that only one GPIO pin is compartible with PWM but i need 4 is there any way to give PWM output using 4 GPIO pins...
I for myself have made bad experiences using the pi and python for pwm. The software pwm the RPi.GPIO library provides is very prone to 'hick-ups' when ever any additional workload appears. In my case for example opening a ssh connection immediately caused an irregular flicker. It will work with any gpio the way Deepesh descibed. But you must not be sensitive to occasional failures in your motor speed/light intensity/what ever. Python on the raspberry pi will not do its purpose in case of pwm if you want to achieve good results! When using the Raspberry for pwm I would highly recommend using C for coding (if you are able to do so, use assembler. It's not so hard to implement pwm with assembler ;). Then using 4 or 5 pins for seperate pwm funktions should not be a problem, I guess. But - believe me - no python
An alternative way is to add hardware that can do the PWM, example PCA9685.
Never mind, I found a way
Have a look at this:
import time import RPi.GPIO as GPIO GPIO.setmode(GPIO.BCM) GPIO.setup(4,GPIO.OUT) while True: GPIO.output(4,True) time.sleep(0.00001)#1 GPIO.output(4,False) time.sleep(0.02)#2 #This is how PWM works
Just increase the number of zeres after '.' in 1 to make the LED or whatever glow dimmer