Arduino GSM Gboard Sim900:无法连接到服务器

Arduino GSM Gboard Sim900:无法连接到服务器,arduino,gsm,Arduino,Gsm,在下面的源代码中,我使用带跳线的GBoard Itead Sim900和GSMShield库将tsData的内容发送到服务器(GSM\U GPRSLibrary\U AT、GSM\U GPRSLibrary\U呼叫、GSM\U GPRSLibrary\U客户端、GSM\U GPRSLibrary\U GPS、GSM\U GPRSLibrary\U服务器、GSM\U GPRSLibrary\U SMS) 但是,GBoard似乎没有连接到ThingSpeak服务器 你能帮我修一下这辆车吗 我有以下

在下面的源代码中,我使用带跳线的GBoard Itead Sim900和GSMShield库将
tsData
的内容发送到服务器(GSM\U GPRSLibrary\U AT、GSM\U GPRSLibrary\U呼叫、GSM\U GPRSLibrary\U客户端、GSM\U GPRSLibrary\U GPS、GSM\U GPRSLibrary\U服务器、GSM\U GPRSLibrary\U SMS)

但是,GBoard似乎没有连接到ThingSpeak服务器

你能帮我修一下这辆车吗


我有以下代码:

const byte DATA = 8;
int cont1=0;
int cont2=0;
int cont3=0;
int connectTCP;
unsigned long time;

#include "SIM900.h"
#include <SoftwareSerial.h>
#include "inetGSM.h"
//#include <GSM.h>
//#include <SPI.h>
//#include <Ethernet.h>
//#include "sms.h"
//#include "call.h"    
InetGSM inet;   
#define PINNUMBER ""           
// APN data
#define GPRS_APN       "-"  // replace your GPRS APN
#define GPRS_LOGIN     "-"     // replace with your GPRS login
#define GPRS_PASSWORD  "-"  // replace with your GPRS password        
char serverAddress[] = "server.com";
String writeAPIKey = "---";   
long lastConnectionTime = 0;
boolean lastConnected = false;
boolean started=false;
int failedCounter = 0;  
void setup()
{
// Start Serial for debugging on the Serial Monitor
Serial.begin(9600);
Serial.println("GSM Shield testing.");
  //Start configuration of shield with baudrate.
  //For http uses is raccomanded to use 4800 or slower.
  if (gsm.begin(2400)){
    Serial.println("\nstatus=READY");
    started=true;  
  }
  else Serial.println("\nstatus=IDLE");
  // 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(inet.attachGPRS(GPRS_APN, GPRS_LOGIN, GPRS_PASSWORD))
      notConnected = false;
    else
    {
      Serial.println("Not connected");
      delay(1000);
    }
  }
}  
void loop()
{ 
time = millis()/999;      
  }     
  // if there's incoming data from the net connection.
  // send it out the serial port.  This is for debugging
  // purposes only:
if (gsm.available())
{
char c = gsm.read();
Serial.print(c);
}
// Disconnect from server
if (!gsm.available() && lastConnected)
{
Serial.println("...disconnected");
Serial.println();
int disconnectTCP();
}

// Update server
if(!gsm.available() && (millis() - lastConnectionTime > 120000))
{         
 funtcion a();//[Example]

}
}
// Check if gsmboard needs to be restarted
//if (failedCounter > 3 ) {startEthernet();}
//lastConnected = client.connected();

void updateServer(String tsData)
{
if (inet.connectTCP(serverAddress, 80))
{
gsm.SimpleWrite("POST /update HTTP/1.1\n");
gsm.SimpleWrite("Host: server.com\n");
gsm.SimpleWrite("Connection: close\n");
gsm.SimpleWrite("SERVER: ");
gsm.SimpleWrite("writeAPIKey");
gsm.SimpleWrite("\n");
gsm.SimpleWrite("Content-Type: application/x-www-form-urlencoded\n");
gsm.SimpleWrite("Content-Length: ");
gsm.SimpleWrite(tsData.length());
gsm.SimpleWrite("\n\n");
gsm.SimpleWrite(tsData.c_str());//----IN THIS LINE I THINK IS THE PROBLEM----
lastConnectionTime = millis();
if (inet.connectedClient())
{
Serial.println("Connecting to SERVER...");
Serial.println();
failedCounter = 0;
}
else
{
failedCounter++;
Serial.println("Connection to SERVERfailed ("+String(failedCounter, DEC)+")");
Serial.println();
}
}
else
{
failedCounter++;
Serial.println("Connection to SERVERFailed ("+String(failedCounter, DEC)+")");
Serial.println();
lastConnectionTime = millis();
}
}

谢谢你的回复。我已经做了更改,但是GBoard无法连接到服务器,在本例中是Thingspeak。控制台输出是相同的。我有一个GBoard itead sim900,跳线是ST->D2和SR->D3,我使用的库是GSMShield(GSM_GPRSLibrary_AT,GSM_GPRSLibrary_Call;GSM_GPRSLibrary_客户端,GSM_GPRSLibrary_GPS,GSM_GPRSLibrary_服务器,GSM_GPRSLibrary_SMS)。好的。我将编辑问题以指定问题。谢谢。
 GSM Shield testing.
ATT: OK
RIC: AT

OK

DB:ELSE
ATT: OK
RIC: AT

OK

DB:ELSE
ATT: OK
RIC: AT

OK

DB:ELSE
ATT: OK
RIC: AT

OK

DB:CORRECT BR
ATT: OK
RIC: AT

OK

ATT: OK
RIC: AT&F

OK

ATT: OK
RIC: ATE0

OK

ATT: OK
RIC: 
OK

ATT: OK
RIC: 
OK

ATT: OK
RIC: 
OK

ATT: OK
RIC: 
OK

ATT: +CPMS:
RIC: 
+CPMS: 30,30,30,30,30,30

OK

ATT: OK
RIC: 
OK

ATT: SHUT OK
RIC: 
SHUT OK


status=READY
ATT: ERROR
RIC: 
ERROR

DB:STARTING NEW CONNECTION
ATT: SHUT OK
RIC: 
SHUT OK

DB:SHUTTED OK
ATT: OK
RIC: 
OK

DB:APN OK
ATT: OK
RIC: 
OK

DB:CONNECTION OK
ATT: ERROR
RIC: 
--.--.--.--

DB:ASSIGNED AN IP
1//----------------Counter--------------
ATT: OK
RIC: 
OK

DB:RECVD CMD
ATT: CONNECT OK
RIC: 
OK

ATT: OK
RIC: 
CONNECT OK

DB:OK TCP
ATT: >
RIC: 
> 
DB:>
Connecting to Server...


CLOSED

ERROR