Unsure how to integrate geolocate in my code


#1

There’s this example: https://github.com/dmiddlecamp/cellular-geolocation-demo/blob/master/firmware/single-tower/singleFile/main.ino

Which I would like to use for this Wake-on-move project: https://go.particle.io/shared_apps/59b7136fce6ba1db8d000aa2

I would like my Electron to output an approximated longitude/latitude upon waking up. So far I’ve been trying numerous things for the entire day, but cannot find anything that works. What would the case inside void loop() have to look like?

Any help is greatly appreciated.


#2

Your second link leads to an empty project. Do you have code to show us?


#3

Whoops sorry, here you go: https://go.particle.io/shared_apps/59b7136fce6ba1db8d000aa2

The code isn’t too important though, my main issue is that I’m not sure how to apply the geolocate code in a switch statement


#4

Nevermind, not sure what I did wrong at first, but re-did it this morning and worked on first attempt:

https://go.particle.io/shared_apps/59b81b228a1f007cfc0001a7

EDIT: Found that SYSTEM_THREAD(ENABLED); makes it almost impossible to gather the geodata. It would typically take a minimum of two minutes to retrieve it. Instead, calling SYSTEM_THREAD(DISABLED) right before making the cellular location request will fetch the geodata in only 10 seconds.