I'm trying to use the below code, which I got from some Arduino project online which updates Arduino data to google sheets cloud. This code controls Nodemcu using a serial AT Commands sent from Arduino serial.
I tried several times and in diff ways to communicate with Nodemcu from Arduino using the code, but no response from nodemcu esp 8266 module. is there any error or modifications to be made in the code, as because my circuit and modules are working perfectly independently.
below is the code, some plz suggest!!!
// code to communicate with nodemcu esp8266 module using AT commands from arduino serial & upload data to google cloud using pushingbox.
#define DST_HOST "213.186.33.19" //IP Address (Pushingbox)
String devid="vAFCC5109D44ADC6"; //Device Id
unsigned long server_update=0;
void setup()
{
Serial.begin(9600);
wifi_setup();
delay(2000);
}
void loop()
{
if(millis()-server_update>14000)
{
delay(200);
google();
server_update=millis();
}
delay(600);
}
void wifi_setup()
{
Serial2.begin(115200);
String ssid ="xxxxxxxxx";
String password="xxxxxxxx";
Serial2.println("AT+RST"); //To Reset Module
if(Serial2.find("CONNECTED"))
{
}
else;
delay(4000);
String cmd ="AT+CWJAP="" + ssid + "","" + password + """;
Serial2.println(cmd); //To Setup wifi
if(Serial2.find("CONNECTED"))
{
Serial.println("connected");
}
else
{
Serial.println("error not connected");
}
Serial2.println("AT+CIPMUX=0"); //To setup a single link
delay(3000);
}
void google() //Google Data Update
{
String cmd = "AT+CIPSTART="TCP","";
cmd += DST_HOST;
cmd += "",80";
Serial2.println(cmd);
delay(500);
cmd = "GET /pushingbox?devid=";
cmd += devid;
cmd += "Host: api.pushingbox.com\r\n\r\n";
String str= "AT+CIPSEND=";
str += String(cmd.length());
Serial2.println(str);
delay(500);
Serial2.println(cmd);
}

