我有Arduino Leonardo和Seeedstudio GPRS Shield v2.0。他們兩人都無縫工作。 上主要GPRS以下教程屏蔽link here,我已經成功地編譯下面的代碼的Arduino:Seeedstudio SIM900 Arduino GPRS盾V2.0不回覆終端的迴應
//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
}
上面的代碼中採取的AT命令從串行輸入,並把它傳遞給GPRS模塊。所以,我可以輸入類似於「ATD + + 1XXXXXXXX」的代碼來調用數字,並且它可以工作。問題是我無法從gprs模塊串行獲得響應,這只是後面的空白。我讀到,對串行終端的響應應該是:「OK」。我的問題是:
a。有什麼我錯過了嗎?我想得到回覆寫入終端。
灣我想提出http請求,有人有經驗如何做?我的意思是這GPRS打開網站blablablabla.com/cs/blabla.php?name=blabla這是
THX前
當你說「ATD + + 1XXXXXX」工作時,「工作」是什麼意思?你看到了什麼結果? –
@SList我沒有看到任何迴應,我知道它工作,因爲我從arduino盾 – wrez