Skip to content

Instantly share code, notes, and snippets.

@Relys
Created July 30, 2020 01:32
Show Gist options
  • Save Relys/993ae37db4023e644f0d2f9ea93327aa to your computer and use it in GitHub Desktop.
Save Relys/993ae37db4023e644f0d2f9ea93327aa to your computer and use it in GitHub Desktop.
poll gps data from ESP8266
#echo 'Time,Latitude,Longitude'> output.csv;while true; do python3 gps.py; sleep .5; done | tee -a output.csv
import urllib.request
import re
fp = urllib.request.urlopen("http://192.168.1.118")
mybytes = fp.read()
mystr = mybytes.decode("utf8")
fp.close()
temp=re.findall(r'-?[0-9]*\.[0-9]*',mystr)
time=re.search(r'[0-9]*\s:\s[0-9]*\s:\s[0-9]*\s(AM|PM)',mystr).group(0)
print(time+','+temp[0]+','+temp[1])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment