Exemplo n.º 1
0
def trafficLightPlan(lat, lng, car_type, car_ip, TrafficLightIP):
    Reference_lat = 0
    Reference_lng = 0
    normal = 'normal'
    #unnormal='unnormal'

    if car_type == normal:
        print 'sent traffic light signal back'
        #send back to car
        #address=('127.0.0.1' ,9090)
        address = (car_ip, 9090)
        Instruction = 'green light is on'
        time.sleep(1)
        send_And_receive.send(Instruction, address)

    else:
        Instruction = 'turn on x axis green light for special the car'
        #to traffic light
        #address=('127.0.0.1' ,8080)
        address = (TrafficLightIP, 8080)
        #address=(Find_my_ip.find() ,8080)

        time.sleep(1)
        send_And_receive.send(Instruction, address)
        print 'sent traffic light signal to traffic light'
def send(lat, lng,car_type,ServerIP):
	address=(ServerIP,2333)
	send_And_receive.send(str(lat),address)
	time.sleep(0.3)
	send_And_receive.send(str(lng),address)
	time.sleep(0.3)
	send_And_receive.send(str(car_type),address)
	time.sleep(0.3)
	send_And_receive.send(str(Find_my_ip.find()),address)
	'''
Exemplo n.º 3
0
def sendInstruction1(Instruction):
    #address=('134.76.63.1' ,8080)
    #address=('10.10.8.1' ,8080)
    address = ('127.0.0.1', 8080)
    send_And_receive.send(Instruction, address)
    print 'sent Traffic light instruction:' + str(Instruction)