pin usage as parameter

This commit is contained in:
tillraab 2019-09-10 15:26:02 +02:00
parent d721c94513
commit ba74f54df9

View File

@ -262,11 +262,11 @@ def main():
# LED on when here ... wait for switch to start data aquisition # LED on when here ... wait for switch to start data aquisition
GPIO.output(11, GPIO.HIGH) GPIO.output(LED1_pin, GPIO.HIGH)
LED_status[0] = True LED_status[0] = True
while GPIO.input(16) == GPIO.LOW: while GPIO.input(Button1_pin) == GPIO.LOW:
sleep(.1) sleep(.1)
GPIO.output(11, GPIO.LOW) GPIO.output(LED1_pin, GPIO.LOW)
LED_status[0] = False LED_status[0] = False
LED_t = time() LED_t = time()
@ -275,19 +275,19 @@ def main():
disp_eth_power = True disp_eth_power = True
try: try:
while GPIO.input(16) == GPIO.HIGH: while GPIO.input(Button1_pin) == GPIO.HIGH:
# blinking LED # blinking LED
if time() - LED_t < .1 and LED_status[0] == False: if time() - LED_t < .1 and LED_status[0] == False:
LED_status[0] = True LED_status[0] = True
GPIO.output(11, GPIO.HIGH) GPIO.output(LED1_pin, GPIO.HIGH)
if time() - LED_t >= .1 and LED_status[0] == True: if time() - LED_t >= .1 and LED_status[0] == True:
LED_status[0] = False LED_status[0] = False
GPIO.output(11, GPIO.LOW) GPIO.output(LED1_pin, GPIO.LOW)
if time() - LED_t >= LED_t_interval: if time() - LED_t >= LED_t_interval:
LED_t = time() LED_t = time()
# dist & eth0 controll # dist & eth0 controll
if GPIO.input(18) == GPIO.HIGH: if GPIO.input(Button2_pin) == GPIO.HIGH:
if disp_eth_power == True: if disp_eth_power == True:
subprocess.run(['tvservice', '-o']) subprocess.run(['tvservice', '-o'])
subprocess.run(['vcgencmd', 'display_power', '0']) subprocess.run(['vcgencmd', 'display_power', '0'])