So I create an another program that can run stepper motor clockwise and counter clockwise with a ramp up and ramp down in there and adding limiter switch on GPIO 16 and 26 to stop the pi.wave_send_using_mode(wid2, pigpio.WAVE_MODE_ONE_SHOT_SYNC) giving a chain wave, this is my code:

import time
import pigpio



pi = pigpio.pi()

pi.set_mode(GPIO, pigpio.OUTPUT)
pi.set_mode(21, pigpio.OUTPUT)

statee = 0
    while True:


        offset = pi.wave_get_micros()
        for delay in range(START_DELAY, FINAL_DELAY, -STEP):
           wf.append(pigpio.pulse(1<<GPIO, 0,       delay))
           wf.append(pigpio.pulse(0,       1<<GPIO, delay))

        for i in range(500):
            wf.append(pigpio.pulse(1<<GPIO, 0,       FINAL_DELAY))
            wf.append(pigpio.pulse(0,       1<<GPIO, FINAL_DELAY))
        wf.append(pigpio.pulse(0, 0, offset))

        for delay in range(FINAL_DELAY, START_DELAY, STEP):
           wf.append(pigpio.pulse(1<<GPIO, 0,       delay))
           wf.append(pigpio.pulse(0,       1<<GPIO, delay))


        wid2 = pi.wave_create()

        pi.wave_send_using_mode(wid2, pigpio.WAVE_MODE_ONE_SHOT_SYNC)

        if pi.read(26) == 0:
            pi. wave_tx_stop()
        if pi.read(16) == 0:

        if statee == 0:
            statee = 1
        elif statee == 1:
            statee = 0
except KeyboardInterrupt:
    print ("\nCtrl-C pressed.  Stopping PIGPIO and exiting...")

the problem happen when the mottor run arround 5 - 10 minutes, I give an error message like this:

Traceback (most recent call last):

File "/home/pi/Desktop/ramp.py", line 49, in <module>
    if pi.read(16) == 0:
  File "/usr/local/lib/python3.4/dist-packages/pigpio.py", line 1401, in read
    return _u2i(_pigpio_command(self.sl, _PI_CMD_READ, gpio, 0))
  File "/usr/local/lib/python3.4/dist-packages/pigpio.py", line 989, in _pigpio_command
    sl.s.send(struct.pack('IIII', cmd, p1, p2, 0))
AttributeError: 'NoneType' object has no attribute 'send'

So, what the cause of error in my code? Is that cause by pi.read(26) and pi.read(16)? Is there any other ways to stop or terminate pi.wave_send_using_mode(wid2, pigpio.WAVE_MODE_ONE_SHOT_SYNC) at the middle of it process? thank you small note: I set pigpiod daemon start on boot by folow (How to Run pigpiod on boot KimSJ answer), is the method of runimg pigpiod cause this error? thank you

  • I've had it running for about half an hour without a problem. Which version of pigpio are you using? Check with pigs pigpv. I don't remember any fixes in this area but it's probably best to be running the latest version (V68). – joan Dec 4 '18 at 21:55

It may be the pi.stop() causing the problem. I'm not sure what you intend but that terminates the connection to the pigpio daemon.

I think you should comment out the calls to pi.stop() after pi.read(26) and pi.read(16).

  • oooh, actualy I just want to stop or terminate pi.wave_send_using_mode(wid2, pigpio.WAVE_MODE_ONE_SHOT_SYNC) process when the the stroke beld driver linear stepper motor when it touch reference limiter switch on pi.read(26) and pi.read(16). Is that posible by just using pi.wave_tx_stop()? Thank You – Jan sebastian Dec 5 '18 at 16:36
  • @Jansebastian Yes, just call wave_tx_stop, that will stop any waves (including a wave chain). No pulses will be sent until you start a new wave or wave chain. – joan Dec 5 '18 at 17:16

Most likely cause I can see: you have a rogue space in line 49:

pi. wave_tx_stop()

should be


Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.