Pages: [1]   Go Down
Author Topic: GSM Web Client  (Read 2377 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I am using the GSM Shield with RFRobot backpack and I am running the program Web Client example. I have not yet set a PIN on the GSM which is for the most part in its defaulted state. I have not set a login or password either yet on the sm5100b.

Code:
/*
  Web client
 
 This sketch connects to a website through a GSM shield. Specifically,
 this example downloads the URL "http://arduino.cc/" and prints it
 to the Serial monitor.
 
 Circuit:
 * GSM shield attached to an Arduino
 * SIM card with a data plan
 
 created 8 Mar 2012
 by Tom Igoe
 
 http://arduino.cc/en/Tutorial/GSMExamplesWebClient
 
 */

// libraries
#include <GSM.h>

// PIN Number
#define PINNUMBER ""

// APN data
#define GPRS_APN       "att.mvno" // replace your GPRS APN
#define GPRS_LOGIN     ""    // replace with your GPRS login
#define GPRS_PASSWORD  "" // replace with your GPRS password

// initialize the library instance
GSMClient client;
GPRS gprs;
GSM gsmAccess;

// URL, path & port (for example: arduino.cc)
char server[] = "arduino.cc";
char path[] = "/";
int port = 80; // port 80 is the default for HTTP

void setup()
{
  // initialize serial communications and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }

  Serial.println("Starting Arduino web client.");
  // connection state
  boolean notConnected = true;
  
  // After starting the modem with GSM.begin()
  // attach the shield to the GPRS network with the APN, login and password
  while(notConnected)
  {
    if((gsmAccess.begin(PINNUMBER)==GSM_READY) &
        (gprs.attachGPRS(GPRS_APN, GPRS_LOGIN, GPRS_PASSWORD)==GPRS_READY))
      notConnected = false;
    else
    {
      Serial.println("Not connected");
      delay(1000);
    }
  }

  Serial.println("connecting...");

  // if you get a connection, report back via serial:
  if (client.connect(server, port))
  {
    Serial.println("connected");
    // Make a HTTP request:
    client.print("GET ");
    client.print(path);
    client.println(" HTTP/1.0");
    client.println();
  }
  else
  {
    // if you didn't get a connection to the server:
    Serial.println("connection failed");
  }
}

void loop()
{
  // if there are incoming bytes available
  // from the server, read them and print them:
  if (client.available())
  {
    char c = client.read();
    Serial.print(c);
  }
  
  // if the server's disconnected, stop the client:
  if (!client.available() && !client.connected())
  {
    Serial.println();
    Serial.println("disconnecting.");
    client.stop();

    // do nothing forevermore:
    for(;;)
      ;
  }
}

My SIM card is an H20 Wireless $40/Month plan that is supposed to have 400mb of data with it. Right now my serial output is coming out as "not connected". I am hoping to get the device to read some data from yahoo.com is all I really need to do with it right now. Thanks in advance for any help out in this regard! I am able to dial out and send SMS.


P.S.
My call to at+senddata is returning

+CME ERROR: operation not supported
+CME ERROR send data failed.

What are the potential causes for this? I am following the white paper for at send data commands and manually calling the at+senddata from the terminal.
« Last Edit: March 31, 2013, 10:43:55 pm by sepy » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 20
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi:

Reading your post it looks like you are not using the Arduino GSM/GPRS shield:
http://store.arduino.cc/eu/index.php?main_page=product_info&cPath=11_5&products_id=244

but another one.

The example and the supporting library are prepared for the Arduino shield. May that be the reason?
Logged

México; Edo. Méx.
Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

yeah in fact you have to obtain the respective datasheet of at command for your device and after thad modify the library on the At commands to acces to GPRS
Logged

Pages: [1]   Go Up
Jump to: