I am absolutely new at arduino but ok with writing code. I am trying to upload 20 points of interest lat/long as a static file that sits on my arduino. Then I want to use my GPS sensor and a function which uses the haversine formula to constantly measure distance between all 20 points and the GPS data from the arduino and output the distance to the nearest point on an LCD screen.

I cannot figure out how to store and reference that list of GPS points of interest.


The Arduino does not have a file system per-se, to which you could upload files, unless you create the code that does that. There is "EEPROM" space on the Arduino processor that can hold 1024 bytes of data and survives power-cycles. That should be sufficient to hold 20 lon/lat pairs of sufficient precision.

As for how to get the waypoint data onto the Arduino, you could transfer them over the serial port from your computer, either by manual entry from your computer over the serial monitor of the Arduino IDE or by writing a script in Python or some other language to read the waypoint file and transmit the data according to the protocol you invented.

There are are also SD Card peripherals you can add to an Arduino, so you could potentially just load the waypoint file onto the SD Card from your computer, and then insert the card into the SD Card reader on the Arduino and have it read the data from there.

|improve this answer|||||
  • So can I declare them as global variables in the beginning of the sketch, then upload the sketch and have a function that handles the math to figure out the distance? – Nick D Feb 23 '18 at 14:48
  • Yes, you could do that, but then the waypoints would be hardcoded to your sketch and you would have to re-flash the Arduino to get new waypoints. Your question made it sound like you wanted to have an easily-changeable file of waypoints. – jose can u c Feb 23 '18 at 14:54
  • I do. I was just trying to think of something for the mvp but then figure out a file system later. I will definitely look at the EEPROM space solution. Thanks for the quick answer and your patience with this new Arduino enthusiast. – Nick D Feb 23 '18 at 14:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.