I need a signal at the output of the GIPO of approximately this shape.(sub-pulse in pulse)
How can this be implemented using PWM on PI? Im trying do it with RPIO,but his ancient GPIO pinout maybe not working for my Rpi 3 b+.
from RPIO import PWM
servo = PWM.Servo()
servo.set_servo(12, 10000)
PWM.add_channel_pulse(0, 12, start=200, width=2000)
Not Signal on pin. I'm confused in it and would like to try the built-in library to work with PWM, but I did not find there the possibility of sub-cycles. How else i can a signal of this form be output from different GPIO?
The documentation suggests that simply passing a list of channels as the first argument to both GPIO.setup and GPIO.output will accomplish what you are asking.
chan_list = [11,12] # add as many channels as you want!
# you can tuples instead i.e.:
# chan_list = (11,12)
GPIO.setup(chan_list, GPIO.OUT)
GPIO.output(chan_list, GPIO.LOW) # sets all to GPIO.LOW
It seems, you should use code like this. Unfortunately, I have no chance to test it since I have no frequency meter or oscillograph.
import time
import pigpio
GPIO=12
pulse = []
# ON OFF MICROS
pulse.append(pigpio.pulse(1<<GPIO, 0, 5))
pulse.append(pigpio.pulse(0, 1<<GPIO, 5))
pulse.append(pigpio.pulse(1<<GPIO, 0, 5))
pulse.append(pigpio.pulse(0, 1<<GPIO, 1e7))
pi = pigpio.pi() # connect to local Pi
pi.set_mode(GPIO, pigpio.OUTPUT)
pi.wave_add_generic(pulse)
wid = pi.wave_create()
if wid >= 0:
pi.wave_send_repeat(wid)
time.sleep(60) # or another condition for stop processing
pi.wave_tx_stop()
pi.wave_delete(wid)
pi.stop()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With