Discuss here different C compiler set ups, and compiling executables for the ESP8266

User avatar
By Jeen26
#63046 I am using ESP8266 with Arduino Uno. I want to data log some variables to Pushingbox. I tried using the code withThingspeak server and it works perfectly. The same code fails for Pushingbox. I tried to push values using the pushingbox url via browser and it works.

This is the code I am using

Code: Select all#include <stdlib.h>



// connect 10 to TX of Serial USB
// connect 11 to RX of serial USB
SoftwareSerial ser(10, 11); // RX, TX


void setup() {               
 
  // enable debug serial
  Serial.begin(9600);
  // enable software serial
  ser.begin(9600);
 
  // reset ESP8266
  ser.println("AT+RST");
}


// the loop
void loop() {

  // TCP connection
  String cmd = "AT+CIPSTART=\"TCP\",\"";
  cmd += "api.pushingbox.com"; //
  cmd += "\",80";
  ser.println(cmd);
  Serial.println(cmd);
   
  if(ser.find("Error")){
    Serial.println("AT+CIPSTART error");
    return;
  }
 
  // prepare GET string
  String getStr = "GET api.pushingbox.com/pushingbox?devid=vB142D4A918331D6&tempdata=53";
 
  // send data length
  cmd = "AT+CIPSEND=";
  cmd += String(getStr.length());
  ser.println(cmd);
  Serial.println(cmd);
  if(ser.find(">")){
    ser.print(getStr);
    Serial.print(getStr);
  }
  else{
    ser.println("AT+CIPCLOSE");
    // alert user
    Serial.println("AT+CIPCLOSE");
  }

  delay(16000); 
}



I also tried to do GET requests using AT commands via serial monitor but it gets timeout as I enter the values.