i am using GM862 module and i want to write the cordinates as it is in a file "cordinates.txt" but i get some error, this is the code i wrote:
import MDM
cordlist = []
f = open("cordinates.txt", 'w')
def AcquiredPosition():
res = MDM.send('AT$GPSACP\r', 0)
res = MDM.receive(30)
if(res.find('OK') != -1):
tmp = res.split("\r\n")
res = tmp[1]
tmp = res.split(" ")
return tmp[1]
else:
return ""
while (1):
res = MDM.receive(60)
p = AcquiredPosition()
cordlist.append(p)
cordlist.append("\r\n")
f.writelines(cordlist)
so the problem that the cordinates are being repeted in the list each time the appened happened.
and this is an example of the file content called "cordinates.txt":
160439.246,2612.7206N,05027.6068E,3.0,23.6,2,339.34,4.21,2.27,181109,03 first time
160439.246,2612.7206N,05027.6068E,3.0,23.6,2,339.34,4.21,2.27,181109,03 repeted1
160445.246,2612.7305N,05027.6079E,3.0,23.6,2,161.61,6.37,3.43,181109,03 first time
160439.246,2612.7206N,05027.6068E,3.0,23.6,2,339.34,4.21,2.27,181109,03 repeted2
160445.246,2612.7305N,05027.6079E,3.0,23.6,2,161.61,6.37,3.43,181109,03 repeted1
160451.246,2612.7634N,05027.5939E,3.0,23.6,2,143.18,1.36,0.73,181109,03 first time
160439.246,2612.7206N,05027.6068E,3.0,23.6,2,339.34,4.21,2.27,181109,03 repeted3
160445.246,2612.7305N,05027.6079E,3.0,23.6,2,161.61,6.37,3.43,181109,03
160451.246,2612.7634N,05027.5939E,3.0,23.6,2,143.18,1.36,0.73,181109,03
160458.246,2612.7471N,05027.5979E,3.0,23.6,2,333.97,7.66,4.13,181109,03
160439.246,2612.7206N,05027.6068E,3.0,23.6,2,339.34,4.21,2.27,181109,03 and so on...
160445.246,2612.7305N,05027.6079E,3.0,23.6,2,161.61,6.37,3.43,181109,03
160451.246,2612.7634N,05027.5939E,3.0,23.6,2,143.18,1.36,0.73,181109,03
160458.246,2612.7471N,05027.5979E,3.0,23.6,2,333.97,7.66,4.13,181109,03
160504.246,2612.7496N,05027.5961E,3.0,47.2,3,316.66,3.16,1.70,181109,04
160439.246,2612.7206N,05027.6068E,3.0,23.6,2,339.34,4.21,2.27,181109,03
160445.246,2612.7305N,05027.6079E,3.0,23.6,2,161.61,6.37,3.43,181109,03
160451.246,2612.7634N,05027.5939E,3.0,23.6,2,143.18,1.36,0.73,181109,03
160458.246,2612.7471N,05027.5979E,3.0,23.6,2,333.97,7.66,4.13,181109,03
160504.246,2612.7496N,05027.5961E,3.0,47.2,3,316.66,3.16,1.70,181109,04
160510.000,2612.7446N,05027.5996E,3.0,53.7,3,162.56,0.50,0.27,181109,04
thanks for any help.