Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
def handleEmergencyMessage(client, userdata, msg):
print(msg.topic + ' ' + str(msg.payload))
dataReceived = json.loads(msg.payload)
gpsLocation[0] = dataReceived["lat"]
gpsLocation[1] = dataReceived["lon"]
gps_tuple = tuple(gpsLocation)
distanceCalculated = int(vincenty(TRAFFIC_SIGNAL, gps_tuple).meters)
print ("Emergency Vehicle Location: ", distanceCalculated)
if distanceCalculated >= 150:
emergencyVehicleState["state"] = 0
trafficLightNormalCurrState = LIGHT_RED
else:
emergencyVehicleState["state"] = 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment