import test_gpio import test_jodo test_gpio.setting_gpio() test_jodo.setting() test_gpio.GPIO.add_event_detect(test_jodo.pin_jodo, test_gpio.GPIO.FALLING, callback=test_jodo.jodo_interrpt) try: while (True): jodo = test_jodo.jodo_data_d0() print(jodo) test_gpio.time.sleep(1) except KeyboardInterrupt: print("close") test_gpio.cleaning()
def ending(): gpio.cleaning() client.sockClosing()
def ending(): gpio.cleaning()
gpio.time.sleep(0.5) if (c == 0 and l == 0 and r == 0): moter.setMoterControl(0, 5) while (True): l, c, r = line.line_data() #forward if (l == 1 and c == 0 and r == 1): #print("go1") moter.setMoterControl(speed, df) #right elif (l == 1 and r == 0): #print("go2") moter.setMoterControl(speed, 3) #left elif (l == 0 and r == 1): #print("go3") moter.setMoterControl(speed, 4) moter.setMoterControl(0, 5) if (l == 0 and c == 0 and r == 0): print("go4") break gpio.cleaning()
def ending(): limit.remove_interrput() app2.remove_interrput() gp.cleaning()
def read_limit(): data = [] for i in limit: data = data +[gp.GPIO.input(i)] return data try: setting_limit() setting_interrupt() while(True): i = 1 act.setActControl(90,2) if(data_inerrupt != 0): act.setActControl(0, 3) remove_interrput() break gp.time.sleep(0.2) except KeyboardInterrupt: print('종료') gp.cleaning() ''' try: while(True): i =1 except KeyboardInterrupt: print('종료') '''