def touch_feedback():
    number_count = []
    while True:
        try:
            if human_sensor.humansensor_value != []:

                value = human_sensor.humansensor_value.pop(0)
                touch_number = value[6:8]
                if value[4:6] == '01':
                    if touch_number != '00':
                        human_sensor.send(red)
                    else:
                        human_sensor.send(blue)

                    if (touch_number == '02'):
                        sixmic('6', '2')

                    if (touch_number in ['08', '04']):
                        number += 1
                        if number > 10:
                            backcharger(position_nav)
                            print('我去%s点了哦!' % position_nav)
                            number = 0
                    else:
                        number = 0

                    if (touch_number in touch_msg):
                        if touch_msg[touch_number][1] == 5:
                            sixmic('6', '3',
                                   random.choice(touch_msg[touch_number][0]))
                            number_count.append(touch_number)
                            #print(number_count)
                    if (number_count != []):
                        for x in number_count:
                            touch_msg[x][1] -= 1
                            if (touch_msg[x][1] <= 0):
                                touch_msg[x][1] = 5
                                number_count.remove(x)

        except Exception as e:
            with open('program_error.txt', 'a') as result:
                result.write("\n************" + str(e) + 'number\n')
Exemple #2
0
def touch_feedback():
    global number,number_set,voice,isposition
    number_count = []
    while True:
        try:
            if human_sensor.humansensor_value != []:
            
                value = human_sensor.humansensor_value.pop(0)
                touch_number = value[6:8]
                #print(type(isposition),value)
                if value[4:8] == '0001':
                    if number == 0 and isposition:
                        #print('我说话了哦!')
                        sixmic('6','3',voice.strip())
                    number += 1
                    if number >= int(number_set):
                        number = 0
                if value[4:8] == '0000':
                    number = 0
                if value[4:6] == '01':
                    if touch_number != '00':
                        human_sensor.send(red)
                    else:
                        human_sensor.send(blue)
                        
                    if(touch_number == '02'):
                        sixmic('6','2')
                        
                    if (touch_number in touch_msg) :
                        if touch_msg[touch_number][1]==5:
                            sixmic('6','3',random.choice(touch_msg[touch_number][0]))
                            number_count.append(touch_number)
                    if(number_count != []):
                        for x in number_count:
                            touch_msg[x][1] -= 1
                            if(touch_msg[x][1] <= 0):
                                touch_msg[x][1] = 5
                                number_count.remove(x)
                    
        except Exception as e:
            with open('program_error.txt','a') as result:
                result.write("\n************" + str(e) +'number\n')
Exemple #3
0
def touch_feedback():
    number_count = []
    while True:
        #print("touch_feedback:",navigation_model_thread.statuscode_value[0])
        try:
            if navigation_model_thread.statuscode_value != []:

                value = navigation_model_thread.statuscode_value.pop(0)
                print(value)

                if value == 701 or value == 403:
                    human_sensor.send(green)
                    sixmic('6', '3', '有人来了哦!')
                else:
                    human_sensor.send(blue)
                    print(value)

        except Exception as e:
            with open('program_error.txt', 'a') as result:
                result.write("\n************" + str(e) + 'number\n')
Exemple #4
0
def touch_feedback():
    number_count_02 = number_count_04 = number_count_08 = number_count_10 = number_count_20 = 3

    number_count = [
        number_count_02, number_count_04, number_count_08, number_count_10,
        number_count_20
    ]
    while True:
        try:
            if human_sensor.humansensor_value != []:

                value = human_sensor.humansensor_value.pop(0)
                touch_number = value[6:8]

                if value[4:6] == '01':
                    if touch_number != '00':
                        human_sensor.send(red)
                    else:
                        human_sensor.send(blue)

                    if (touch_number == '02'):
                        sixmic('6', '2')
                        print('唤醒成功!')

                    if (touch_number in ['08', '0C', '04']):
                        number += 1
                        print(number)
                        if number > 10:
                            backcharger(position_nav)
                            print('我去%s点了哦!' % position_nav)
                            number = 0
                    else:
                        number = 0
                    if (touch_number in touch_msg):
                        sixmic('6', '3',
                               random.choice(touch_msg[touch_number]))
        except Exception as e:
            with open('program_error.txt', 'a') as result:
                result.write("\n************" + str(e) + 'number\n')