Created
July 30, 2020 01:32
-
-
Save Relys/993ae37db4023e644f0d2f9ea93327aa to your computer and use it in GitHub Desktop.
poll gps data from ESP8266
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
#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