Skip to content

Instantly share code, notes, and snippets.

@yuma-m
Created February 14, 2016 09:03
Show Gist options
  • Save yuma-m/64563e78b1a9e29b0e18 to your computer and use it in GitHub Desktop.
Save yuma-m/64563e78b1a9e29b0e18 to your computer and use it in GitHub Desktop.
Print Raspberry Pi GPIO Pin Status
#!/usr/local/bin/python
# -*- coding: utf-8 -*-
from __future__ import print_function
import RPi.GPIO as GPIO
import time
# Pin Number
PIN = 19
GPIO.setmode(GPIO.BCM)
GPIO.setup(PIN, GPIO.IN, pull_up_down=GPIO.PUD_UP)
while True:
pin_status = GPIO.input(PIN)
print(pin_status)
time.sleep(0.1)
GPIO.cleanup()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment