bug fix
This commit is contained in:
parent
5957b30b8f
commit
38a5f3c8c2
12
LED_check.py
12
LED_check.py
@ -1,7 +1,7 @@
|
|||||||
import RPi.GPIO as GPIO
|
import RPi.GPIO as GPIO
|
||||||
from uldaq import (get_daq_device_inventory, DaqDevice, AInScanFlag, ScanStatus,
|
from uldaq import (get_daq_device_inventory, DaqDevice, AInScanFlag, ScanStatus,
|
||||||
ScanOption, create_float_buffer, InterfaceType, AiInputMode)
|
ScanOption, create_float_buffer, InterfaceType, AiInputMode)
|
||||||
from time import time
|
from time import time, sleep
|
||||||
|
|
||||||
|
|
||||||
def GPIO_setup(LED1_pin, LED2_pin, Button1_pin, Button2_pin):
|
def GPIO_setup(LED1_pin, LED2_pin, Button1_pin, Button2_pin):
|
||||||
@ -43,7 +43,7 @@ def main():
|
|||||||
|
|
||||||
# loop_t = time()
|
# loop_t = time()
|
||||||
|
|
||||||
while time() - t0 < 5:
|
while time() - t0 < 10:
|
||||||
# print(time() - loop_t)
|
# print(time() - loop_t)
|
||||||
# LED1 blink every 2 sec
|
# LED1 blink every 2 sec
|
||||||
if time() - LED1_t < .1 and LED_status[0] == False:
|
if time() - LED1_t < .1 and LED_status[0] == False:
|
||||||
@ -75,7 +75,13 @@ def main():
|
|||||||
|
|
||||||
if GPIO.input(Button2_pin) == GPIO.HIGH:
|
if GPIO.input(Button2_pin) == GPIO.HIGH:
|
||||||
print('button 2 pressed')
|
print('button 2 pressed')
|
||||||
|
if GPIO.input(Button1_pin) == GPIO.HIGH:
|
||||||
|
if LED_status[0] == False:
|
||||||
|
GPIO.output(LED1_pin, GPIO.HIGH)
|
||||||
|
if LED_status[1] == False:
|
||||||
|
GPIO.output(LED2_pin, GPIO.HIGH)
|
||||||
|
sleep(2)
|
||||||
|
break
|
||||||
|
|
||||||
# loop_t = time()
|
# loop_t = time()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user