Menu

#39 wait_for_edge event-limit (RuntimeError: Error #3 waiting for edge)

Duplicate
nobody
None
Medium
Defect
2015-02-22
2013-04-22
Anonymous
No

Originally created by: danielpe...@gmail.com
Originally owned by: btcros...@googlemail.com

There seems to be a limit to how many wait_for_edge-events can be processed.
I use a circuit that switches the input on and off around 60 times per second. Everything is working until I hit a reproducable limit of 1017 events.

The used code:

import RPi.GPIO as GPIO
import time

GPIO.setmode(GPIO.BOARD)
channel = 7
avg = 0
i = 0
starttime = time.time()
print "starttime: " + str(starttime)

GPIO.setup(channel, GPIO.IN, pull_up_down=GPIO.PUD_UP)
while True:
    try: 
        GPIO.wait_for_edge(channel, GPIO.RISING) 
        print GPIO.input(channel)
        t = time.time()
        starttime = t - starttime
        avg = (avg + starttime) / 2
        print "elapsed: " + str(starttime)
        print "avg: " + str(int(avg*1000))
        print i
        i += 1
        starttime = t
    except KeyboardInterrupt: 
        GPIO.cleanup()

After holding the button on my circuit for a while the process exits with this errormessage:
...
elapsed: 0.0232310295105                                                                                                             
avg: 23                                                                                                                              
1016                                                                                                                                 
1                                                                                                                                    
elapsed: 0.0233290195465                                                                                                             
avg: 23                                                                                                                              
1017                                                                                                                                 
Traceback (most recent call last):                                                                                                   
  File "input.py", line 17, in <module>                                                                                              
RuntimeError: Error #3 waiting for edge

Related

Tickets: #38
Tickets: #72

Discussion

  • Anonymous

    Anonymous - 2013-04-22

    Originally posted by: btcros...@googlemail.com

    Might already be fixed in source code library - a possible fix was in place before any issue was identified.

    Mergedinto: 38
    Owner: btcros...@googlemail.com
    Status: Duplicate

     
  • Anonymous

    Anonymous - 2013-05-02

    Originally posted by: lpc...@gmail.com

    I am having the same issue with 0.5.2a. I tried to run cleanup() every time an edge is detected, but still the same result. Is there a work around?

     
  • Anonymous

    Anonymous - 2013-08-22

    Originally posted by: sau...@embedded-projects.net

    I have the same problem. After 1016 rounds or interrupts:

    T 1014
    T 1015
    T 1016
    Exception in thread Thread-1:
    Traceback (most recent call last):
      File "/usr/lib/python2.7/threading.py", line 552, in __bootstrap_inner
      File "/usr/lib/python2.7/threading.py", line 505, in run
      File "/var/www/server.py", line 25, in DoTheDew
    RuntimeError: Error #3 waiting for edge

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.