Skip to content

Instantly share code, notes, and snippets.

@murilopontes
Created June 30, 2014 19:48
Show Gist options
  • Save murilopontes/f87de083750ca16afa09 to your computer and use it in GitHub Desktop.
Save murilopontes/f87de083750ca16afa09 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
import thread
import sys
import time
import Adafruit_BBIO.GPIO as GPIO
def gpio_test(pin):
while True:
GPIO.wait_for_edge(pin,GPIO.BOTH)
if GPIO.input(pin):
print "\033[1;32m",
else:
print "\033[1;31m",
print pin,"\033[m"
def test(pin):
print pin
pins = [ "P9_11","P9_12","P9_13","P9_14","P9_15","P9_16","P9_17","P9_18","P9_19","P9_20","P9_21","P9_22","P9_23","P9_24","P9_25","P9_26","P9_27","P9_28","P9_29","P9_30","P9_31","P9_41","P9_42","P8_7","P8_8","P8_9","P8_10","P8_11","P8_12","P8_13","P8_14","P8_15","P8_16","P8_17","P8_18","P8_19","P8_26","P8_27","P8_28","P8_29","P8_30","P8_31","P8_32","P8_33","P8_34","P8_35","P8_36","P8_37","P8_38","P8_39","P8_40","P8_41","P8_42","P8_43","P8_44","P8_45","P8_46" ]
print "pins len=",len(pins)
for pin in pins:
#try:
GPIO.setup(pin,GPIO.IN,GPIO.PUD_OFF)
#GPIO.add_event_detect(pin,GPIO.BOTH)
#GPIO.add_event_callback(pin,test)
#GPIO.gpio_function(pin)
print pin,
for i in range(1,50):
print GPIO.input(pin),
print ""
#except:
#print pin, "ERROR"
#pass
#while True:
# time.sleep(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment