Skip to content

Instantly share code, notes, and snippets.

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
emergencyVehicleState["state"] = 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.