2
AT 명령을 사용하여 셀룰러 연결 arduino 온도 센서에서 xively.com으로 데이터를 보내려고합니다. TCP 연결을 열 수는 있지만 바로 닫힙니다. 왜 TCP 연결이 계속 닫습니까?AT 명령으로 Adruino GPRS에서 xively로 연결하는 동안 TCP 연결이 계속 닫히는 이유는 무엇입니까?
설정 : 아두 이노 우노 mackbook seeedstudio GPRS 2.0 AT & T는 gophone SIM 카드 여기
내 터미널 판독 :
Call Ready
AT
OK
AT+CPIN?
+CPIN: READY
OK
AT+CGATT?
+CGATT: 1
OK
AT+CIPSHUT
SHUT OK
AT+CIPSTATUS
OK
STATE: IP INITIAL
AT+CIPMUX=0
OK
AT+CSTT="wap.cingular"
OK
AT+CIICR
OK
AT+CIFSR
10.52.49.206
AT+CIPSTART="TCP","api.xively.com","80"
OK
STATE: TCP CLOSED
내 설정 : SEEEDStudio GPRS 보호 아두 이노 우노 macbook
AT 명령을 보내려면 sheild에들, 나는 다음과 같은 코드를 사용하여 시리얼 릴레이를 설정 한 :
//Serial Relay - Arduino will patch a
//serial link between the computer and the GPRS Shield
//at 19200 bps 8-N-1
//Computer is connected to Hardware UART
//GPRS Shield is connected to the Software UART
#include <SoftwareSerial.h>
SoftwareSerial GPRS(7, 8);
unsigned char buffer[64]; // buffer array for data recieve over serial port
int count=0; // counter for buffer array
void setup()
{
GPRS.begin(19200); // the GPRS baud rate
Serial.begin(19200); // the Serial port of Arduino baud rate.
}
void loop()
{
if (GPRS.available()) // if date is comming from softwareserial port ==> data is comming from gprs shield
{
while(GPRS.available()) // reading data into char array
{
buffer[count++]=GPRS.read(); // writing data into array
if(count == 64)break;
}
Serial.write(buffer,count); // if no data transmission ends, write buffer to hardware serial port
clearBufferArray(); // call clearBufferArray function to clear the storaged data from the array
count = 0; // set counter of while loop to zero
}
if (Serial.available()) // if data is available on hardwareserial port ==> data is comming from PC or notebook
GPRS.write(Serial.read()); // write it to the GPRS shield
}
void clearBufferArray() // function to clear buffer array
{
for (int i=0; i<count;i++)
{ buffer[i]=NULL;} // clear all index of array with command NULL
}
내가 다음 명령을 입력하고 CoolTerm와 시리얼 통신을 모니터링 할 수 있습니다.
있습니까? – Goodword
내가 기억하는 한, 나는 연결을 열어 둘 수 있었지만 반드시 영원히는하지 않았다. :) –