Hi,
I was unable to send GPS data or any data using python script. But all the parts (like connecting to GPRS, successfully sending data to server getting GPS data etc) work perfect when I send AT command manually.
Please have a look at the code and suggest me what to modify-
import MDM
import MOD
ip='IP'
apn = 'gpinternet'
server = '0.0.0.0'
MDM.send('AT+CGDCONT=1,'+ip+','+apn+','+server+'\r',0)
res = MDM.receive(20)
print res
username = 'whatever'
password = 'whatever'
MDM.send('AT#USERID='+username+'\r',0)
res = MDM.receive(20)
print res
MDM.send('AT#PASSW='+password+'\r',0)
res = MDM.receive(20)
print res
MDM.send("AT#GPRS=1\r",0)
res = MDM.receive(80)
print res
MDM.send('AT$GPSACP\r',0)
gps = 'This is GPS data:'+MDM.receive(30)
gps = gps.replace(' ','')
gps = gps.replace('\r','')
gps = gps.replace('\n','')
gps = gps.replace('OK','')
print gps
web = 'www.e-secretary.net'
MDM.send('AT#SKTD=0,80,'+web+'\r',0)
res = MDM.receive(50)
print res
req1 = 'GET /gps/dgl.php?name='+gps+' HTTP/1.0'
req2 = 'Host: '+web
req3 = 'Connection: keep-alive'
MDM.send(req1,0)
MDM.sendbyte(0x0d,0)
MDM.sendbyte(0x0a,0)
res = MDM.receive(10)
MDM.send(req2,0)
MDM.sendbyte(0x0d,0)
MDM.sendbyte(0x0a,0)
res = MDM.receive(10)
MDM.send(req3,0)
MDM.sendbyte(0x0d,0)
MDM.sendbyte(0x0a,0)
MDM.sendbyte(0x0d,0)
MDM.sendbyte(0x0a,0)
res = MDM.receive(100)
print res
Also please suggest me an easy way to debug python modules easily without using hardware debugger.
Is there any way to show output or responses or variable values in rsterm or terminal?
Thanks in advance.