我正在使用SIM 900 GSM模块,我使用此代码进行基于GSM的数据连接。但问题是我没有从我的代码中获得任何反馈。我来自孟加拉国,使用当地SIM卡提供商的SIM卡(Grameen Phone(Telenor))。它的APN是gpinternet / gpwap。但是什么是用户名&密码。如果模块可以连接,那么它将显示一些正反馈否则为负。但它没有显示任何东西我的问题在哪里?谁能帮我。
#include <GSM.h>
#define PINNUMBER "1234"
// APN data
#define GPRS_APN "gpinternet" // replace your GPRS APN
#define GPRS_LOGIN "" // replace with your GPRS login
#define GPRS_PASSWORD "" // replace with your GPRS password
// initialize the library instance
GPRS gprs;
GSM gsmAccess; // include a 'true' parameter for debug enabled
GSMServer server(80); // port 80 (http default)
// timeout
const unsigned long __TIMEOUT__ = 10 * 100;
void setup() {
// initialize serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
// connection state
boolean notConnected = true;
// Start GSM shield
// If your SIM has PIN, pass it as a parameter of begin() in quotes
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("Connected to GPRS network");
// start server
server.begin();
//Get IP.
IPAddress LocalIP = gprs.getIPAddress();
Serial.println("Server IP address=");
Serial.println(LocalIP);
}
void loop() {
// listen for incoming clients
GSMClient client = server.available();
if (client) {
while (client.connected()) {
if (client.available()) {
Serial.println("Receiving request!");
bool sendResponse = false;
while (char c = client.read()) {
if (c == '\n') {
sendResponse = true;
}
}
// if you've gotten to the end of the line (received a newline
// character)
if (sendResponse) {
Serial.println("HI man");
}
}
}
}
}