Skip to content

Instantly share code, notes, and snippets.

@mohammedhanine
Created October 14, 2016 13:24
Show Gist options
  • Select an option

  • Save mohammedhanine/90fae2d5bcd2990f685a6818d571cf0e to your computer and use it in GitHub Desktop.

Select an option

Save mohammedhanine/90fae2d5bcd2990f685a6818d571cf0e to your computer and use it in GitHub Desktop.
String readString;
void setup()
{
Serial.begin(115200);
delay(200);
Serial.println("AT");
delay(1000);
Serial.println("AT+CREG=0");
delay(2000);
Serial.println("AT+CGATT=1");
delay(2000);
Serial.println("AT+AGPS=1");
delay(2000);
Serial.println("AT+CGDCONT=1,\"IP\",\"freedompop.foggmobile.com\"");
delay(2000);
Serial.println("AT+CGACT=1,1");
delay(2000);
Serial.println("AT+CIPSTART=\"TCP\",\"163.172.37.175\",4444");
delay(2000);
Serial.println("AT+GPSRD");
delay(2000);
Serial.println("AT+CIPSEND");
Serial.println("iniciando");
Serial.println(char(26));//the ASCII code of the ctrl+z is 26
}
void loop()
{
delay(3000);
while (Serial.available()) {
delay(3); //delay to allow buffer to fill
if (Serial.available() >0) {
char c = Serial.read(); //gets one byte from serial buffer
readString += c; //makes the string readString
}
}
if(readString != ""){
Serial.println("AT+CIPSEND");
Serial.println(readString);
Serial.println(char(26));//the ASCII code of the ctrl+z is 26
readString="";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment