Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!eternal-september.org!feeder.eternal-september.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'subsequent': 0.05; '[],': 0.09; 'false,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:script': 0.09; '{},': 0.09; 'python': 0.11; 'changes': 0.15; 'false):': 0.16; 'false:': 0.16; 'increment': 0.16; 'inputs': 0.16; 'loop.': 0.16; 'message- id:@4ax.com': 0.16; 'presume': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'skip:> 20': 0.16; 'true:': 0.16; 'input': 0.22; 'passes': 0.24; 'url:home': 0.24; 'regardless': 0.24; 'looks': 0.24; 'script': 0.25; '(for': 0.26; 'header:X-Complaints-To:1': 0.27; 'apparently': 0.31; 'subject:what': 0.31; 'says': 0.33; 'running': 0.33; 'subject:the': 0.34; 'subject:with': 0.35; 'there': 0.35; 'skip:> 10': 0.36; 'doing': 0.36; 'charset:us-ascii': 0.36; 'wrong': 0.37; 'received:76': 0.38; 'to:addr:python-list': 0.38; 'anything': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'how': 0.40; 'read': 0.60; 'gone': 0.61; 'first': 0.61; 'email addr:gmail.com': 0.63; 'high': 0.63; 'here': 0.66; 'subject:get': 0.81; 'subject:this': 0.83; 'low': 0.83; 'here...': 0.84; 'high,': 0.84; 'this...': 0.84; 'treats': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Dennis Lee Bieber Subject: Re: what is wrong with this script and how do I get the value in a php script Date: Sun, 12 Oct 2014 12:47:00 -0400 Organization: IISS Elusive Unicorn References: <05f27d81-372d-4242-bc62-e738e23680d4@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: adsl-76-249-27-202.dsl.klmzmi.sbcglobal.net X-Newsreader: Forte Agent 6.00/32.1186 X-No-Archive: YES X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 78 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1413132432 news.xs4all.nl 2875 [2001:888:2000:d::a6]:47749 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:79003 On Sun, 12 Oct 2014 07:24:52 -0700 (PDT), martijnperdaan@gmail.com declaimed the following: >what is wrong with this script and how do I get the value Rij1 and Rij2 and Rij3 and Rij4 and Rij5 and Rij6 in a php script > Well, I don't see anything that looks like PHP here... >import RPi.GPIO as GPIO Presume this means running on a Raspberry PI... There is a newsgroup just for them; comp.sys.raspberry-pi >GPIO.setmode(GPIO.BCM) > >GPIO.setup(17, GPIO.IN) >GPIO.setup(18, GPIO.IN) >GPIO.setup(21, GPIO.IN) >GPIO.setup(22, GPIO.IN) >GPIO.setup(23, GPIO.IN) >GPIO.setup(24, GPIO.IN) > >Rij1 = 0 >Rij2 = 0 >Rij3 = 0 >Rij4 = 0 >Rij5 = 0 >Rij6 = 0 > > >while True: > PRij1 = GPIO.input(17) > PRij2 = GPIO.input(18) > PRij3 = GPIO.input(21) > PRij4 = GPIO.input(22) > PRij5 = GPIO.input(23) > PRij6 = GPIO.input(24) > > if (PRij1 == False): Over kill or erroneous depending upon what GPIO.input() actually returns... if not PRij1: is sufficient, since Python treats 0, 0.0, False, [], {}, and None as "FALSE" > Rij1 = Rij1 + 1 > while PRij1 == False: > PRij1 = GPIO.input(17) This loop is going to block the program from doing ANYTHING until that input changes to true. > > if (PRij2 == False): > Rij2 = Rij2 + 1 > while PRij2 == False: > PRij2 = GPIO.input(18) > Same for this... And all the rest... You are incrementing a counter that apparently says the input was low, and then waiting for the input to go high, regardless of any other inputs. > > Totaal = Rij1 + Rij2 + Rij3 + Rij4 + Rij5 + Rij6 You will only get here once ALL inputs have gone True. Totaal will then contain the count of inputs that were not high when you first read the pins (for the first cycle of the main loop). Subsequent passes of the main loop will continue to increment the Rijx for those pins that were low at the top of the loop. -- Wulfraed Dennis Lee Bieber AF6VN wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/