Created
June 29, 2018 09:12
-
-
Save shyampurk/78d50e5d6d2b5c574146ab2e8d397316 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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