Hello,
I am new here. and this is my first post.
I am using SIM808 v3.2 shield.
in my program, i am trying to get the speed from the GPS.
GPS ON DEMAND
serText = 'AT+CGPSINF=32\r'
READ serial until OK is found
readReply = True
nn=1
cmdFound = False
okFound = False
while readReply:
serText = sim808.readline().decode()
#print (" readline ", nn, serText)
nn += 1
serText TYPES indicators
cmdIndic = serText.find (cmdLine) >= 0
nullIndic = serText == ""
noneIndic = len(serText) <= 3
okIndic = serText.find ("OK") >= 0
errorIndic = serText.find ("ERROR") >= 0
GPSdata1 = serText.find ("CGPSINF:") >= 0
GPSdata2 = serText.find ("$GPRMC") >= 0
if GPSdata1 or GPSdata2:
GPSdata = serText
elif okIndic:
readReply = False
okFound = True
#print (" OK RECORD")
elif errorIndic:
readReply = False
readContinue = False
#print (" ERROR RECORD")
elif cmdIndic:
#print (" COMMAND LINE echo RECORD")
cmdFound = True
pass
elif nullIndic or noneIndic:
pass
else:
check_other_serial_text (serText)
#print (" UNKNOWN")
pass
if okFound:
'''
format A of GPS data found
+CGPSINF: 32,033132.000,A,1021.2115,N,12355.1064,E,0.593,304.33,231217,,,A
+CGPSINF: 32,033530.000,V,0000.0000,N,00000.0000,E,0.056,254.65,231217,,,N
(tt[24:25]) = A/V
'''
GPSdataSplit = GPSdata.split(',')
#print (tempT)
prevGPSstat = global_last_GPSread_valid
check if VALID GPS is found
if GPSdataSplit[2] == "A":
global_last_GPSdata = GPSdataSplit
global_last_GPSread_valid = True
global_GPS_err_cnt = 0
#print ("validGPS", global_last_GPSdata)
check if SPEED status change
global_prev_speed_status = global_curr_speed_status
currSpeed = float (GPSdataSplit [7])
print ("\n GPS speed", currSpeed, ")
my set up during coding and testing is such that my device is on my desk, and the antenna is by the window, absolutely stationary (not moving).
however, the currSpeed I get varies from
1.5 something TO 0 (zero)
anyone have an idea why? or am i getting the wrong speed info?