Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
def loraReceive():
global loraM
count = 0
while True:
print "LoRa Packet Receive Start"
try:
data = str(loraM.recv())
if data == "01": #Code 01 indicates primary communication failure
print "Received LoRa Signal from Emergeny Vehicle"
emergencyVehicleState["state"] = 1
count = 0
else:
count = count + 1
if count == 20:
count = 0
emergencyVehicleState["state"] = 0
except Exception as error:
print error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment