mirror of
https://github.com/node-red/node-red-nodes.git
synced 2023-10-10 13:36:58 +02:00
fix gpio initial read timing and order
This commit is contained in:
parent
c79bcfbd0e
commit
05a9312905
@ -118,11 +118,12 @@ if len(sys.argv) > 2:
|
|||||||
else:
|
else:
|
||||||
GPIO.setup(pin,GPIO.IN)
|
GPIO.setup(pin,GPIO.IN)
|
||||||
|
|
||||||
print(GPIO.input(pin))
|
|
||||||
if bounce > 0:
|
if bounce > 0:
|
||||||
GPIO.add_event_detect(pin, GPIO.BOTH, callback=handle_callback, bouncetime=int(bounce))
|
GPIO.add_event_detect(pin, GPIO.BOTH, callback=handle_callback, bouncetime=int(bounce))
|
||||||
else :
|
else :
|
||||||
GPIO.add_event_detect(pin, GPIO.BOTH, callback=handle_callback)
|
GPIO.add_event_detect(pin, GPIO.BOTH, callback=handle_callback)
|
||||||
|
sleep(0.1)
|
||||||
|
print(GPIO.input(pin))
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "node-red-node-pi-gpio",
|
"name": "node-red-node-pi-gpio",
|
||||||
"version": "1.1.0",
|
"version": "1.1.1",
|
||||||
"description": "The basic Node-RED node for Pi GPIO",
|
"description": "The basic Node-RED node for Pi GPIO",
|
||||||
"dependencies" : {
|
"dependencies" : {
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user