SparkFun Forums 

Where electronics enthusiasts find answers.

Have questions about a SparkFun product or board? This is the place to be.
By keilan2
#189355
Hey everyone,

I've looking at writing a python script to periodically post some information to a server via a Telit HE910. We have a registered SIM card and I can enter AT commands directly into the terminal and have things work as expected, however it is failing to initialize via the python script. The problem is somewhere in the following 4 lines - if I enter them manually and then run my script, it POSTs as expected, but if I just run the script (including the same 4 AT commands), it fails.
Code: Select all
#SER.set_speed("115200", "8N1", "hw")
result = MDM.send('AT#SIMDET=2\r', 0)
result = MDM.send('AT+CGDCONT=1,"IP","apn.provider.ca","0.0.0.0",0,0\r', 0)
result = MDM.send('ATD*99***1#\r', 0)
result = MDM.send('AT#SGACT=1,1\r', 0)
I've been fiddling with this for a few days and am definitely reaching the limit of my abilities, I'd appreciate help or even being pointed in the direction of a place with a bit more experience with Telit's python interpreter - I feel like the first one to use it after a bit of googling, haha.

Thanks!
By fll-freak
#189388
Whenever things work by hand and not in an automated way, I look for a few things.
1) Are my strings terminated the way the receiver wants them to be. Is \r the right terminator?
2) Is my script sending stuff too fast for the receiver to process. Try adding some delays between each line. Start crazy like time.sleep(5).