what is wrong with this script and how do I get the value in a php script

Peter Pearson pkpearson at nowhere.invalid
Sun Oct 12 13:01:37 EDT 2014


On Sun, 12 Oct 2014 07:24:52 -0700 (PDT), martijnperdaan at gmail.com wrote:
> 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
>
> import RPi.GPIO as GPIO
> 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):
> 	Rij1 = Rij1 + 1
>        while PRij1 == False:
>             PRij1 = GPIO.input(17)
[snip]

I regret that I can't solve your problem, but perhaps I can move
the conversation in a useful direction.

If this is a question about RPi.GPIO, it would be good to phrase it
as the simplest possible question about RPi.GPIO.  If it's *not* a
question about RPi.GPIO, it would be useful to replace the references
to RPi.GPIO with some artificial substitute, so that people who don't
have RPi.GPIO on their systems can contribute to the discussion.  For
example, I don't know what type of object is returned by GPIO.input.
Your code appears to assume that it's True or False, but I don't know
whether that's a valid assumption.

When asking why something doesn't work, one greatly improves one's
chances of getting a prompt and useful answer if one reveals precisely
(1) what one desires, and (2) what one gets.

Finally, the code you posted is indented in a way that is not legal Python,
leaving people to guess at what you intended to post.

And finally finally, why do you call this a PHP script?  This is a
Python newsgroup.

-- 
To email me, substitute nowhere->runbox, invalid->com.



More information about the Python-list mailing list