Skip to content

Instantly share code, notes, and snippets.

@shyampurk
Created June 29, 2018 09:12
Show Gist options
  • Save shyampurk/78d50e5d6d2b5c574146ab2e8d397316 to your computer and use it in GitHub Desktop.
Save shyampurk/78d50e5d6d2b5c574146ab2e8d397316 to your computer and use it in GitHub Desktop.
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