[RESOLVED] Driving the pwm pins 18 and 19 using python
-
Hello , I need to drive the PWM pins on my omega onion 2+ using python .
I spent a good amount googling stuff , I found that you can run the using the sys file and terminal . And I found python library but for the servo doc.
is there a way for me to drive the PWM in my python code?
-
@haythem quickest and most straightforward way would be to use the
os.system
module to execute the commands listed in the hardware pwm documentation article
-
@Lazar-Demin
will this work in a python script?
import subprocesssubprocess.call("omega2-ctrl gpiomux set pwm0 pwm", shell=True)
subprocess.call("onion pwm 0 50 2000", shell=True)
-
@haythem looks like it should work. try it out and let us know how it goes
-
@Lazar-Demin it works perfectly