Merge branch 'master' of github.com:faydr/LoRa-Tropo

master
Dan 2018-05-26 08:34:50 -06:00
commit 1e031c1286
1 changed files with 14 additions and 4 deletions

View File

@ -2,16 +2,26 @@
import socket
import time
import serial
import pynmea2
UDP_IP = "10.0.0.1"
ser = serial.Serial('/dev/ttyACM0',9600)
UDP_IP = "10.0.0.2"
UDP_PORT = 5005
sock = socket.socket(socket.AF_INET, # Internet
socket.SOCK_DGRAM) # UDP
sock.setblocking(0)
sock.bind((UDP_IP, UDP_PORT))
last_gps = ''
while True:
data, addr = sock.recvfrom(1024) # buffer size is 1024 bytes
print "received message:", data
try:
data, addr = sock.recvfrom(1024) # buffer size is 1024 bytes
print "received message:", data, '/', last_gps
except socket.error: pass
data = ser.readline()
if (data.startswith("$GNGGA")):
last_gps = pynmea2.parse(data)