08-09-2016, 03:52 PM
(This post was last modified: 08-09-2016, 11:46 PM by MarkHaysHarris777.)
Sorry...
... you will need to either code for an internal pull-up, or use an external pull-up resistor.
How are you providing '1' or '0' to the pin(3) GPIO02 ?
Here is the code I use for my test push_button() :
I'm using BCM numbering pin(35) GPIO19
This code works and is tested using debian image, and RPi.GPIO-Pine64 from github
With the pin open (internal pull-up as coded) push_button() returns False... else if the pin is grounded, push_button() returns True.
PS, you'll notice the push_button() is coded back-wards... because I want the push_button() to be a positive thing if pressed, but, if pressed its actually grounding the pin with the pull-up on it...
... you will need to either code for an internal pull-up, or use an external pull-up resistor.
How are you providing '1' or '0' to the pin(3) GPIO02 ?
Here is the code I use for my test push_button() :
I'm using BCM numbering pin(35) GPIO19
Code:
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
p_switch = 19
GPIO.setup(p_switch, GPIO.IN, pull_up_down=GPIO.PUD_UP)
def push_button():
if GPIO.input(p_switch):
return False
else:
return True
This code works and is tested using debian image, and RPi.GPIO-Pine64 from github
With the pin open (internal pull-up as coded) push_button() returns False... else if the pin is grounded, push_button() returns True.
PS, you'll notice the push_button() is coded back-wards... because I want the push_button() to be a positive thing if pressed, but, if pressed its actually grounding the pin with the pull-up on it...

marcushh777
please join us for a chat @ irc.pine64.xyz:6667 or ssl irc.pine64.xyz:6697
( I regret that I am not able to respond to personal messages; let's meet on irc! )

please join us for a chat @ irc.pine64.xyz:6667 or ssl irc.pine64.xyz:6697
( I regret that I am not able to respond to personal messages; let's meet on irc! )