7 years ago.

To Wei Zou

Hi Sir,

May I ask you a few things?

1. Is my connection right or wrong?

Mbed GPRS Shield

-VU to VIN

-GND to GND

-p9 to D0

-p10 to D1

2. May I kindly ask you that : Could I have a picture or a diagram of how you connect Mbed to Seeed GPRS Shield V2.0?

3. One more thing is: I do not know my SIM Card voltage type, whether it is 3V or 1.8V or 5V sir.

4. I do not insert the battery at the battery holder.

I used main.cpp program the one that you wrote.

  1. include "mbed.h"
  2. include "GPRSInterface.h"

/ On many platforms USBTX/USBRX overlap with serial on D1/D0 pins and enabling the below will interrupt the communication.

  • You can use an LCD display to print the values or store them on an SD card etc.
  • / Serial pc(USBTX, USBRX);

/**

  • D1 - TX pin (RX on the WiFi side)
  • D0 - RX pin (TX on the WiFi side)
  • 115200 - Baud rate
  • "apn" - APN name
  • "username" - APN username
  • "password" - APN passowrd
  • /

GPRSInterface eth(D1, D0, 115200, "shppd", "", "");

int main() { printf("Hello\n"); wait(3);

Initialize the interface. If no param is passed to init() then DHCP will be used on connect() int s = eth.init(); if (s != NULL) { printf(">>> Could not initialise. Halting!\n"); exit(0); }

printf(">>> Get IP address...\n"); while (1) { s = eth.connect(); Connect to network

if (s == false || s < 0) { printf(">>> Could not connect to network. Retrying!\n"); wait(3); } else { break; } } printf(">>> Got IP address: %s\n", eth.getIPAddress());

Prepare the http request to mbed.org char http_cmd[] = "GET /media/uploads/mbed_official/hello.txt HTTP/1.0\n\n"; TCPSocketConnection sock; sock.connect("mbed.org", 80); sock.send_all(http_cmd, sizeof(http_cmd)-1); printf(">>> Sent request to mbed.org\n");

Read the response char buffer[300]; int ret; while (true) { ret = sock.receive(buffer, sizeof(buffer)-1); if (ret <= 0) break; buffer[ret] = '\0'; printf(">>> Received %d chars from mbed.org:\n%s\n", ret, buffer); } sock.close();

Disconnect from network eth.disconnect(); return 0; }

I am really looking forward to your reply Sir.

Thank you so much. I really need your help.

Regards Dorothy

Question relating to:

a library to use GPRS like ethernet or wifi, which makes it possible to connect to the internet with your GPRS module

1 Answer

6 years, 12 months ago.

the main.cpp above is not written by me, it is writen by Mihail Stoyanov, and mine is https://mbed.org/users/lawliet/code/Seeed_GPRS_Library_HelloWorld/file/46f9e36be3fa/main.cpp. you can refer to it. If it still can not work, please use the serial debug to check that whether GPRS Shield can work at AT commands.

Accepted Answer

Hi Sir,

Thank yo so much for your help.

I really appreciate it very much.

Regards

Dorothy

posted by Dorothy Luai 13 Jun 2014