-->
Page 1 of 2

ESP8266 Sparkfun thing

PostPosted: Mon Dec 28, 2015 3:32 am
by grandwarden
i am gettiing following error when trying to compile code
/*
* This sketch sends data via HTTP GET requests to data.sparkfun.com service.
*
* You need to get streamId and privateKey at data.sparkfun.com and paste them
* below. Or just customize this script to talk to other HTTP servers.
*
*/

#include <ESP8266WiFi.h>

const char* ssid = "CR7";
const char* password = "iamamloneathome";

const char* host = "data.sparkfun.com";
const char* streamId = "XGNmx3D2WjIK8OzwMpOr";
const char* privateKey = "1JA1PmBbnduMgoYdVqox";

void setup() {
Serial.begin(115200);
delay(10);

// We start by connecting to a WiFi network

Serial.println();
Serial.println();
Serial.print("Connecting to ");
Serial.println(ssid);

WiFi.begin(ssid, password);

while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}

Serial.println("");
Serial.println("WiFi connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
}

int value = 0;

void loop() {
delay(5000);
++value;

Serial.print("connecting to ");
Serial.println(host);

// Use WiFiClient class to create TCP connections
WiFiClient client;
const int httpPort = 80;
if (!client.connect(host, httpPort)) {
Serial.println("connection failed");
return;
}

// We now create a URI for the request
String url = "/input/";
url += streamId;
url += "?private_key=";
url += privateKey;
url += "&value=";
url += value;

Serial.print("Requesting URL: ");
Serial.println(url);

// This will send the request to the server
client.print(String("GET ") + url + " HTTP/1.1\r\n" +
"Host: " + host + "\r\n" +
"Connection: close\r\n\r\n");
delay(10);

// Read all the lines of the reply from server and print them to Serial
while(client.available()){
String line = client.readStringUntil('\r');
Serial.print(line);
}

Serial.println();
Serial.println("closing connection");
}
output:
warning: espcomm_sync failed
error: espcomm_open failed

Re: ESP8266 Sparkfun thing

PostPosted: Mon Dec 28, 2015 4:07 pm
by eduperez
That is not a compilation error, that message means there was a problem while uploading the (already compiled) firmware to the device.

Re: ESP8266 Sparkfun thing

PostPosted: Mon Dec 28, 2015 4:22 pm
by martinayotte
Are you placing GPIO0 to GND to switch ESP into UpLoad mode while resetting or power recycling ?

Re: ESP8266 Sparkfun thing

PostPosted: Wed Dec 30, 2015 10:36 am
by grandwarden
Thank s for the reply.. That might resolve the issue. Most of the connections and scripts available on the internet are of using arising uno and esp8266 while I am using arduino mega 2560.can you help me out with connections.. I am sharing my connection diagram