RPi.GPIO python module for Pine A64/A64+
#41
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



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... Smile
marcushh777    Cool

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! )
  Reply


Messages In This Thread
RE: RPi.GPIO python module for Pine A64/A64+ - by MarkHaysHarris777 - 08-09-2016, 03:52 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  fm transmitter with gpio weasel18 2 4,754 09-10-2019, 04:28 AM
Last Post: desai_amogh
  How to use dts or other setup to declare gpio pin Interrupt (e.g. a button)? dkebler 1 3,549 06-12-2019, 10:37 AM
Last Post: dkebler
Lightbulb Sample GPIO codes highlighting RPi.GPIO-PineA64 and the PI bus MarkHaysHarris777 6 10,961 06-07-2019, 12:37 AM
Last Post: tllim
Star GPIO, SPI and I2C C++ Lib databit 7 11,047 02-04-2019, 05:45 AM
Last Post: Jeff R
Information Howto: Controlling Pine64 GPIO via the filesystem (sysfs) on linux pfeerick 4 11,757 01-24-2019, 03:36 AM
Last Post: Fifth
  GPIO and SPI SamR1 20 31,179 03-15-2018, 10:32 AM
Last Post: jomoengineer
Question GPIO shockr 7 14,594 03-11-2018, 01:52 AM
Last Post: jomoengineer
  Read GPIO problem shworker 14 20,945 08-17-2017, 01:21 PM
Last Post: martinayotte
  Cross-wired Uart Ports between two Pine Boards via Cat5 Cable MarkHaysHarris777 10 15,741 11-20-2016, 04:17 AM
Last Post: pfeerick
  GPIO fiq capability joseph 3 6,012 11-10-2016, 06:07 PM
Last Post: joseph

Forum Jump:


Users browsing this thread: 1 Guest(s)