Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 1246

Python • Pigpio, wave_create returning 0

$
0
0
Hello,

I am trying to make a smooth ramp to speed and back. I have the way to create the correct durations of the square wave.

When I try to make this into a waveform, things seem to work until wave_create..

This is what I am doing:

Code:

if __name__ == '__main__':    pi = pigpio.pi()    if not pi.connected:       exit(0)    pi.wave_clear()    pi.set_mode(d1pul,pigpio.OUTPUT)    pi.set_mode(d2pul,pigpio.OUTPUT)    open_close = []    #create bitmask so that playing the waveform runs both motors    bitmask = 1<<d1pul | 1<<d2pul    print("output mask is")    print(bin(bitmask))    #create the waveform for the entire motion    for each in Planner(50,100,500,10):#Vstart,Vmax,Accel,Dist        ms = int(each[1]*500000)        print(ms)        open_close.append(pigpio.pulse(bitmask,0,ms))        open_close.append(pigpio.pulse(0,bitmask,ms))    pi.wave_add_generic(open_close)    print("Wave data length")    print(len(open_close))    plan = pi.wave_create()#This is the motion with ramp for travel    print("Plan number")    print(plan)    exit(0)    count = 0    while True:        pi.wave_send_once(plan)        print("done"+ str(count))        count = count + 1
And the output to the terminal looks like this:

Code:

output mask is0b11000000000000100008333731766096078607866097317833310000Wave data length20Plan number0
What am I missing?

Statistics: Posted by rallenbaggett — Thu Feb 27, 2025 5:49 pm



Viewing all articles
Browse latest Browse all 1246

Trending Articles