SPIN2 code for Sara-3G-Click module
![VonSzarvas](https://forums.parallax.com/uploads/userpics/814/n2KKWCY80HQA7.png)
Hi !
Someone asked for some example SPIN2 code for the Sara-3G GSM module.
https://www.parallax.com/product/3g-sara-click/
I've attached an archive for PropellerTool that will hopefully provide a headstart.
The uBlox modules are really demanding in both the volume and order of commands required to complete tasks, and I'd recommend anyone working with these modules to follow these tips:
Follow the examples exactly as shown in the uBlox AT-Command and example guides, freely downloadable from the u-Blox website at the Sara-3G product page.
Whilst developing or debugging code, attach two extra PropPlugs to the Sara-3G module. Connect the Sara TX pin to PropPlug #1 RX pin. Connect the Sara RX pin to PropPlug #2 RX pin. Ensure all PropPlugs and the Sara module have a common GND connection. Open two serial terminals on your computer and now you can monitor all commands between your code and the 3G module, live as it happens!
The biggest issue I find when working on comms modules is that you often can't see what's going on at the module level, so adding extra PropPlugs to provide visibility of all the messages, replies possible errors and delays goes a long way to allowing the developer to solve problems!
Comments
In terms of hardware setup, I used these items:
And an old GSM antenna I found in a cupboard!
As mentioned above, the 2 extra PropPlugs were just to speed up debugging, so not required once the code is finished, or not required by those most fearless!
In terms of code, I did this:
Adjust one line in the code, so it has your local mobile phone carrier APN address. ie. change the m2m.sim.com to whatever your carrier says you need.![](https://forums.parallax.com/uploads/editor/ce/c8ar12whhhtj.png)
,
Upload the code to RAM on the P2 Edge module (ie. press F10)