Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #95795

Re: RPI.GPIO Help

Newsgroups comp.lang.python
Date 2015-08-31 11:25 -0700
References <lG5Ax.73238$E26.47630@fx20.iad> <yl0Fx.3282$Ot4.1918@fx05.iad>
Message-ID <4d2a9d2c-7bc3-4d18-a612-d15f0027fe05@googlegroups.com> (permalink)
Subject Re: RPI.GPIO Help
From hakugin.gin@gmail.com

Show all headers | View raw


On Monday, August 31, 2015 at 1:42:16 PM UTC-4, John McKenzie wrote:
> Dennis, Hakugin, I tried your scripts and had to alter a typo here or 
> there, but once the basic errors disappeared I had the same error 
> message. "Conflicting edge detection already enabled for this GPIO 
> channel".
> 
>  As much as I despise web based bulletin board systems I registered on 
> the Raspberry Pi website to ask for help as well.
> 
>  Appreciate the effort you both put in those scripts. Will keep working 
> with them and the general points you made.
> 
>  Still checking here and am discussing all this in the Raspberry pi 
> newsgroup. Thanks to the several people who mentioned it.
> 
>  Again, still listening here if anyone has any more to add.

I apologize, I did make a mistake with the example I provided and I just realized it. Change the code block:

while True: 
    GPIO.add_event_detect(22, GPIO.RISING, callback=red_button, bouncetime=200) 
    GPIO.add_event_detect(23, GPIO.RISING, callback=yellow_button, bouncetime=200) 
    GPIO.add_event_detect(24, GPIO.RISING, callback=blue_button, bouncetime=200) 
    if colour == 1: 
        time_red += 1 
    elif colour == 2: 
        time_yellow += 1 
    elif colour == 3: 
        time_blue += 1 

to:

GPIO.add_event_detect(22, GPIO.RISING, callback=red_button, bouncetime=200) 
GPIO.add_event_detect(23, GPIO.RISING, callback=yellow_button, bouncetime=200) 
GPIO.add_event_detect(24, GPIO.RISING, callback=blue_button, bouncetime=200)

while True: 
    if colour == 1: 
        time_red += 1 
    elif colour == 2: 
        time_yellow += 1 
    elif colour == 3: 
        time_blue += 1


You are getting the error because the script is attempting to perform a "add_event_detect" on the same pins each time the "while" loop iterates. By moving it above the loop the error should stop occuring.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

RPI.GPIO Help John McKenzie <davros@bellaliant.net> - 2015-08-16 19:40 +0000
  Re: RPI.GPIO Help MRAB <python@mrabarnett.plus.com> - 2015-08-16 21:15 +0100
    Re: RPI.GPIO Help John McKenzie <davros@bellaliant.net> - 2015-08-20 15:12 +0000
      Re: RPI.GPIO Help MRAB <python@mrabarnett.plus.com> - 2015-08-20 16:45 +0100
        Re: RPI.GPIO Help alister <alister.nospam.ware@ntlworld.com> - 2015-08-20 15:54 +0000
      Re: RPI.GPIO Help Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2015-08-20 21:27 -0400
        Re: RPI.GPIO Help John McKenzie <davros@bellaliant.net> - 2015-08-28 17:40 +0000
          Re: RPI.GPIO Help hakugin.gin@gmail.com - 2015-08-28 13:56 -0700
          Re: RPI.GPIO Help Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2015-08-29 14:21 -0400
  Re: RPI.GPIO Help John McKenzie <davros@bellaliant.net> - 2015-08-31 17:41 +0000
    Re: RPI.GPIO Help hakugin.gin@gmail.com - 2015-08-31 11:25 -0700
    Re: RPI.GPIO Help MRAB <python@mrabarnett.plus.com> - 2015-08-31 19:34 +0100
    Re: RPI.GPIO Help Johannes Bauer <dfnsonfsduifb@gmx.de> - 2015-09-01 10:58 +0200
  Re: RPI.GPIO Help Tim Daneliuk <tundra@bogus-city.tundraware.com> - 2015-08-31 14:07 -0500
    Re: RPI.GPIO Help Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2015-09-01 02:08 -0400
  Re: RPI.GPIO Help John McKenzie <davros@bellaliant.net> - 2015-09-02 18:50 +0000
  Re: RPI.GPIO Help John McKenzie <davros@bellaliant.net> - 2015-09-09 19:03 +0000
    Re: RPI.GPIO Help MRAB <python@mrabarnett.plus.com> - 2015-09-09 20:29 +0100
  Re: RPI.GPIO Help John McKenzie <davros@bellaliant.net> - 2015-09-10 15:56 +0000
    Re: RPI.GPIO Help John McKenzie <davros@bellaliant.net> - 2015-09-11 18:24 +0000
      Re: RPI.GPIO Help MRAB <python@mrabarnett.plus.com> - 2015-09-11 19:49 +0100
      Re: RPI.GPIO Help hakugin.gin@gmail.com - 2015-09-11 12:00 -0700
      Re: RPI.GPIO Help hakugin.gin@gmail.com - 2015-09-11 12:24 -0700
      Re: RPI.GPIO Help Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2015-09-11 21:10 -0400
  Re: RPI.GPIO Help John McKenzie <davros@bellaliant.net> - 2015-09-13 06:08 +0000
    Re: RPI.GPIO Help Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2015-09-13 12:24 -0400
    Re: RPI.GPIO Help hakugin.gin@gmail.com - 2015-09-14 05:53 -0700

csiph-web