Skip to content

Instantly share code, notes, and snippets.

@xezpeleta
Created December 16, 2013 21:23
Show Gist options
  • Save xezpeleta/7994684 to your computer and use it in GitHub Desktop.
Save xezpeleta/7994684 to your computer and use it in GitHub Desktop.
RPi - Print Button status (1=pushed)
#! /usr/bin/python
import RPi.GPIO as GPIO
import time
BTN = 18
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
GPIO.setup(BTN, GPIO.IN)
print GPIO.input(BTN)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment