lua script save gps to file

Help with any software/desktop related issues. e.g. companion9x, eePe, etc
Post Reply
User avatar
nicholgd
Posts: 70
Joined: Tue Sep 03, 2013 4:29 pm
Country: -
Location: Herefordshire

lua script save gps to file

Post by nicholgd »

Hi,
I'm trying to write (copy, past from various sources) a lua script that displays the models location and also writes the last valid location to a txt file. This is so that the location can be read in the field in the case of a lost model and entered into a smart phone geolocator app. This is particularly valid for slope soaring where the slope can be vast and the bracken 6ft high. with no pen usually available the data will be lost if the TX is turned off . I know the data could be available in the log files but these are not easily read on top of a hill.
I can display the gps data on a telemetry screen via the script but cannot get it to be written to a txt file. Help please what am I missing? Help

background() -- update current GPS position
lcd.drawText(1,11,"GPS:", 0)
lcd.drawText(lcd.getLastPos()+2,11,gpsValue,0)
if (type(gpsValue) == "table") then
local gnfile = io.open("lstgps.txt", "w")
gnfile.write(gpsValue)
gnfile:flush()
gnfile:close()
end
end
Geoff N

Post Reply

Return to “Software”