Ejemplo n.º 1
0
 def testWaitForFalling(self):
     def makelow():
         GPIO.output(LOOP_OUT, GPIO.LOW)
     GPIO.output(LOOP_OUT, GPIO.HIGH)
     t = Timer(0.1, makelow)
     t.start()
     GPIO.wait_for_edge(LOOP_IN, GPIO.FALLING)
Ejemplo n.º 2
0
 def testWaitForRising(self):
     def makehigh():
         GPIO.output(LOOP_OUT, GPIO.HIGH)
     GPIO.output(LOOP_OUT, GPIO.LOW)
     t = Timer(0.1, makehigh)
     t.start()
     GPIO.wait_for_edge(LOOP_IN, GPIO.RISING)
Ejemplo n.º 3
0
#!/usr/bin/env python
import RaPi.GPIO as GPIO
import time
from threading import Timer

PIN_NUM = 12
channel = 7
GPIO.setmode(GPIO.BOARD)
GPIO.setup(PIN_NUM,GPIO.OUT)

GPIO.output(PIN_NUM,True)
print "\n value_%d = %d\n" %(PIN_NUM,GPIO.input(PIN_NUM))

GPIO.setup(channel,GPIO.IN,GPIO.PUD_DOWN)
print "\n value_%d = %d\n" %(channel,GPIO.input(channel))


def makehigh():
	print "\n value_%d = %d\n" %(channel,GPIO.input(channel))
	GPIO.output(PIN_NUM,False)
	print "\n value_%d = %d\n" %(PIN_NUM,GPIO.input(PIN_NUM))
	
	

	
GPIO.wait_for_edge(channel, GPIO.RISING)
t = Timer(1,makehigh)
t.start()