Serial.println("AT+HTTPPARA=\"URL\",\"https://gps.zidan.smkmhd2pku.sch.id/getstate.php?color=All\"");// setting the httppara, the second parameter is the website you want to access
Serial.print("AT+HTTPPARA=\"URL\","); //\"https://gps.zidan.smkmhd2pku.sch.id/getstate.php?color=All\"");// setting the httppara, the second parameter is the website you want to access
Serial.println("\"https://gps.zidan.smkmhd2pku.sch.id/getstate.php?color=All\"");// setting the httppara, the second parameter is the website you want to access
The idea is to send the URL to the SIM800, not the Serial monitor
#include <SoftwareSerial.h>
SoftwareSerial sim800(7, 6); // configure software serial port
int REDLed= 11;
int GREENLed= 3;
int BLUELed= 4;
void setup() {
pinMode(REDLed, OUTPUT);
pinMode(GREENLed, OUTPUT);
pinMode(GREENLed, OUTPUT);
sim800.begin(9600);
Serial.begin(9600);
Serial.print("power up" );
delay(30000);
}
void loop()
{
Serial.println("SubmitHttpRequest - started" );
SubmitHttpRequest();
Serial.println("SubmitHttpRequest - finished" );
delay(10000);
}
void SubmitHttpRequest()
{
sim800.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.
sim800.println("AT+CGATT?"); //Attach or Detach from GPRS Support
delay(100);
ShowSerialData();
sim800.println("AT+SAPBR=3,1,\"CONTYPE\",\"GPRS\"");//setting the SAPBR, the connection type is using gprs
delay(1000);
ShowSerialData();
sim800.println("AT+SAPBR=3,1,\"APN\",\"CMNET\"");//setting the APN, Access point name string
delay(4000);
ShowSerialData();
sim800.println("AT+SAPBR=1,1");//setting the SAPBR
delay(2000);
ShowSerialData();
sim800.println("AT+HTTPINIT"); //init the HTTP request
delay(2000);
ShowSerialData();
sim800.print("AT+HTTPPARA=\"URL\","); //\"http://gps.zidan.smkmhd2pku.sch.id/g.php?color=All\"");// setting the httppara, the second parameter is the website you want to access
sim800.println("\"http://gps.zidan.smkmhd2pku.sch.id/g.php?color=All\"");// setting the httppara, the second parameter is the website you want to access
delay(1000);
ShowSerialData();
sim800.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(!sim800.available());
ShowSerialData();
sim800.println("AT+HTTPREAD");// read the data from the website you access
delay(300);
changeLed();
ShowSerialData();
sim800.println("");
delay(100);
}
void changeLed()
{
String content = "";
// String RedState = content.substring();
while(sim800.available()!=0)
{
//Serial.write(sim800.read());
content = content + String(char (sim800.read()));
}
Serial.println(content);
if(content.substring(30,31)== "1")
{
digitalWrite(REDLed, HIGH);
}
else if (content.substring(30,31)== "0")
{
digitalWrite(REDLed, LOW);
}
if(content.substring(31,32)== "1")
{
digitalWrite(GREENLed, HIGH);
}
else if (content.substring(31,32)== "0")
{
digitalWrite(GREENLed, LOW);
}
if(content.substring(32,33)== "1")
{
digitalWrite(BLUELed, HIGH);
}
else if (content.substring(32,33)== "0")
{
digitalWrite(BLUELed, LOW);
}
content = "";
}
void ShowSerialData()
{
while(sim800.available()!=0)
Serial.write(char (sim800.read()));
}
yes i have change it to http but the link is not fully printed that the problem
maybe that problem from library i was curious about it but i wanna ask you how you can get fully printed link like that?