2016-03-19 24 views
0

Wie öffne ich eine Webseite mit arduino und sim900 Modul Ich bin im Begriff, eine Webseite mit GSM SIM 900 Modul zu öffnen Ich habe versucht mit diesem Code Ich bin nicht vertraut mit den AT-Befehle, so dass dieser Code nur angezeigt wird ok als Antwort auf den Code im seriellen Monitor und es öffnet die Seite nicht so können Sie mir bitte helfen!Öffnen einer Webseite mit sim900

 #include <SoftwareSerial.h> 
SoftwareSerial SIM900(2, 3); // configure software serial port 
void setup() { 
SIM900.begin(19200); 
SIM900power(); 
Serial.begin(19200); 
Serial.print("power up"); 
delay(20000); 
    SIM900.println("AT+CSQ"); // Signal quality check 
delay(100); 
    ShowSerialData();// this code is to show the data from gprs shield, in   order to easily see the process of how the gprs shield submit a http request, and the following is for this purpose too. 
    SIM900.println("AT+CGATT?"); //Attach or Detach from GPRS Support 
    delay(100); 
ShowSerialData(); 
SIM900.println("AT+SAPBR=3,1,\"CONTYPE\",\"GPRS\"");//setting the SAPBR,  the connection type is using gprs 
delay(1000); 
ShowSerialData(); 
SIM900.println("AT+SAPBR=3,1,\"APN\",\"etisalat\"");//setting the APN, Access point name string 
delay(4000) 
    ShowSerialData(); 
SIM900.println("AT+SAPBR=1,1");//setting the SAPBR 
delay(2000); 
ShowSerialData(); 
SIM900.println("AT+HTTPINIT"); //init the HTTP request 
delay(2000); 
ShowSerialData();   SIM900.println("AT+CIPSTART=\"TCP\",\"http://http://www.google.com\",\"80\""); 
    delay(1000); 
ShowSerialData(); 
SIM900.println("AT+CIPSHUT"); //init the HTTP request 
delay(2000); 
ShowSerialData(); 
SIM900.println("AT+HTTPACTION=0");//submit the request 
delay(10000);//the delay is very important, the delay time is base on the return from the website, if the return datas are very large, the time required longer. 
    while(!SIM900.available()); 
ShowSerialData(); 
SIM900.println("AT+HTTPREAD");// read the data from the website you access 
delay(300); 
    ShowSerialData(); 
SIM900.println(""); 
delay(100); 
    } 
void SIM900power() 
    // software equivalent of pressing the GSM shield "power" button 
    { 
digitalWrite(9, HIGH); 
    delay(1000); 
    } 
    void loop() 
    { 
    // Serial.println("SubmitHttpRequest - started"); 
    // SubmitHttpRequest(); 
    // Serial.println("SubmitHttpRequest - finished"); 
    } 
void SubmitHttpRequest() 
    { 
    } 
    void ShowSerialData() 
{ 
    while(SIM900.available()!=0) 
    Serial.write(char (SIM900.read())); 
    } 

Antwort

0

Können Sie bitte das SERIALE Protokoll, das Sie von dieser Kommunikation erhalten, veröffentlichen?

Dies ist der normale Set-up über HTTP abfragen:

Überprüfen Sie, ob die Eintragung in das Netzwerk ist

AT+CREG? 

Überprüfen Sie, ob Sie mit dem Netzwerk

AT+CGATT? 

angebracht sind Stellen Sie das Trägerprofil 1 ein (sehen Sie nach, ob es eine gültige IP-Adresse festlegt)

AT+SAPBR=3,1,"Contype","GPRS" 
AT+SAPBR=3,1,"APN","APNdirection" 
AT+SAPBR=3,1,"USER","APNuser" 
AT+SAPBR=3,1,"PWD","APNpassword" 
AT+SAPBR=2,1 
AT+SAPBR=1,1 

starten HTTP

AT+HTTPINIT 

Select Träger 1

AT+HTTPPARA="CID",1 

die URL Stellen Sie

AT+HTTPPARA="URL","google.com" 

Starten Sie die GET-Aktion

AT+HTTPACTION=0 
anfordern möchten

lesen, sobald es

AT+HTTPREAD 

Terminate HTTP

AT+HTTPTERM 
beendet hat