Hi everyone.
I need to send GPS coordinates to dweet . io.
I am using a SIM7000E module connected to an arduino nano.
I can grab the coordinates using the AT command "AT+CGNSINF".
After that though, I need to be able to define the coordinates i get from "AT+CGNSINF" as a string so that i can input the string name into the URL to perform a get request to dweet.
This is my code currently.
#include <SoftwareSerial.h>
SoftwareSerial SIM7000E(10, 11); //RX, TX
int rx=10;
int tx=11;
void setup() {
pinMode(tx,OUTPUT);
pinMode(rx,INPUT);
Serial.begin(9600);
delay(1000);
SIM7000E.begin(19200);
delay(1000);
Serial.println("Initialising");
delay(1000);
//setting up module
SIM7000E.print("ATE1\r\n");
while(SIM7000E.available())
Serial.write(SIM7000E.read());
delay(2000);
SIM7000E.print("AT+CPIN?\r\n");
while(SIM7000E.available())
Serial.write(SIM7000E.read());
delay(2000);
SIM7000E.print("AT+CIMI\r\n");
while(SIM7000E.available())
Serial.write(SIM7000E.read());
delay(2000);
SIM7000E.print("AT+CGSN\r\n");
while(SIM7000E.available())
Serial.write(SIM7000E.read());
delay(2000);
SIM7000E.print("AT+CMNB=1\r\n");
while(SIM7000E.available())
Serial.write(SIM7000E.read());
delay(2000);
SIM7000E.print("AT+CNMP=38\r\n");
while(SIM7000E.available())
Serial.write(SIM7000E.read());
delay(2000);
SIM7000E.print("AT+CBANDCFG=\"CAT-M\",28\r\n");
while(SIM7000E.available())
Serial.write(SIM7000E.read());
delay(2000);
SIM7000E.print("AT+CGNAPN?\r\n");
while(SIM7000E.available())
Serial.write(SIM7000E.read());
delay(2000);
SIM7000E.print("AT+COPS?\r\n");
while(SIM7000E.available())
Serial.write(SIM7000E.read());
delay(2000);
SIM7000E.print("AT+CSTT?\r\n");
while(SIM7000E.available())
Serial.write(SIM7000E.read());
delay(2000);
SIM7000E.print("AT+CSTT=\"telstra.m2m\"\r\n");
while(SIM7000E.available())
Serial.write(SIM7000E.read());
delay(2000);
SIM7000E.print("AT+CIICR\r\n");
while(SIM7000E.available())
Serial.write(SIM7000E.read());
delay(2000);
SIM7000E.print("AT+CIFSR\r\n");
while(SIM7000E.available())
Serial.write(SIM7000E.read());
delay(2000);
SIM7000E.print("AT+CIPPING=\"www.google.com\"\r\n");
while(SIM7000E.available())
Serial.write(SIM7000E.read());
delay(2000);
SIM7000E.print("AT+CDNSCFG=\"8.8.8.8\"\r\n");
while(SIM7000E.available())
Serial.write(SIM7000E.read());
delay(2000);
SIM7000E.print("AT+SAPBR=3,1,\"APN\",\"TELSTRA.M2M\"\r\n");
while(SIM7000E.available())
Serial.write(SIM7000E.read());
delay(2000);
SIM7000E.print("AT+SAPBR=1,1\r\n");
while(SIM7000E.available())
Serial.write(SIM7000E.read());
delay(2000);
SIM7000E.print("AT+SAPBR=2,1\r\n");
while(SIM7000E.available())
Serial.write(SIM7000E.read());
delay(2000);
//getting GPS coordinates
SIM7000E.print("AT+CGNSPWR=1\r\n");
while(SIM7000E.available())
Serial.write(SIM7000E.read());
delay(5000);
SIM7000E.print("AT+CGNSINF\r\n");
while(SIM7000E.available())
Serial.write(SIM7000E.read());
delay(5000);
//sending data to dweet
SIM7000E.print("AT+HTTPINIT\r\n");
while(SIM7000E.available())
Serial.write(SIM7000E.read());
delay(2000);
SIM7000E.print("AT+HTTPPARA=\"CID\",1\r\n");
while(SIM7000E.available())
Serial.write(SIM7000E.read());
delay(2000);
SIM7000E.print("AT+HTTPPARA=\"URL\",\"http://dweet.io/dweet/for/mything?*coordinates*\"\r\n");
while(SIM7000E.available())
Serial.write(SIM7000E.read());
delay(4000);
SIM7000E.print("AT+HTTPACTION=0\r\n");
while(SIM7000E.available())
Serial.write(SIM7000E.read());
delay(4000);
SIM7000E.print("AT+HTTPREAD\r\n");
while(SIM7000E.available())
Serial.write(SIM7000E.read());
delay(4000);
SIM7000E.print("AT+HTTPTERM\r\n");
while(SIM7000E.available())
Serial.write(SIM7000E.read());
delay(2000);
SIM7000E.print("AT\r\n");
while(SIM7000E.available())
Serial.write(SIM7000E.read());
delay(2000);
}
void loop() {
// put your main code here, to run repeatedly:
}
Thanks for any help.