pytrack sample code
-
Set the
timeout
to a time period (in seconds) for the GPS to search for a lock. If a lock is not found by the time thetimeout
has expired, thecoordinates
method will return(None, None)
.
-
@dan
timeout=180
does this mean that chip will spend 180 sec before locking onto satellites ?
-
- Set up GPS module
- Start measuring timespan (docs) (but I'm not sure why it's there... It was probably left there by mistake, I'll look into that)
- Always get coordinates
-
@dan
can you let me know what are below lines doing in the codel76 = L76GNSS(py, timeout=180) chrono = Timer.Chrono() chrono.start() while (True): coord = l76.coordinates() print(coord)
-
hi @abhishek2101, it seems you have a GPS problem. I would recommend:
- leave the pytrack for 30 mins outside, to pick-up the satellites data, as this is a cold-start, could take a while
- check, with a mobile app, how many satellites are visible on your exact position, it could be a glitch
-
@abhishek2101 it might take some time to find a GPS satellite? If the issue persists, let me know and we'll look into it in detail.
-
@dan
i am outside on a terrace.
-
@abhishek2101 for the time, you either have to set it yourself, or sync it with a NTP server (via WiFi or cellular). Are you inside a building? It might take a while (or even fail) to get a location, so I'd recommend trying it outside or near windows
-
@dan
below is the output i am getting(None, None) - (1970, 1, 1, 0, 2, 13, 827831, None) - 2547456
-
@abhishek2101 Line 37, it prints coordinates (LAT, LONG)
coord
and the timertc.now()
-
@dan
I am able to use above code and print the data, but out of all the data where can I find LAT, LONG and timestamp ?
-
@abhishek2101 Hi, you can find LoRaWAN example here with OTAA (and ABP) which includes sending data. You can get the coordinates from the Pytrack example. If you merge these 2 examples, it would solve your question. Let me know if you have any other questions!