mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
@@ -99,9 +99,9 @@ if len(sys.argv) > 2:
|
||||
|
||||
elif cmd == "in":
|
||||
#print "Initialised pin "+str(pin)+" to IN"
|
||||
bounce = int(sys.argv[4])
|
||||
bounce = float(sys.argv[4])
|
||||
def handle_callback(chan):
|
||||
sleep(bounce/1000)
|
||||
sleep(bounce/1000.0)
|
||||
print GPIO.input(chan)
|
||||
|
||||
if sys.argv[3].lower() == "up":
|
||||
@@ -112,7 +112,7 @@ if len(sys.argv) > 2:
|
||||
GPIO.setup(pin,GPIO.IN)
|
||||
|
||||
print GPIO.input(pin)
|
||||
GPIO.add_event_detect(pin, GPIO.BOTH, callback=handle_callback, bouncetime=bounce)
|
||||
GPIO.add_event_detect(pin, GPIO.BOTH, callback=handle_callback, bouncetime=int(bounce))
|
||||
|
||||
while True:
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user