Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By p1337
#14938 Hello guys,

I´ve got the ESP 8266 - (1) with 8 Pins --> GPIO2 and GPIO0

If I use -

Code: Select allsystem_deep_sleep_set_option(4);
system_deep_sleep(60000000);


then it looks like, the ESP isn´t going into Deep sleep.

What I am trying to do, is this one with Arduino IDE:
http://www.terenceang.com/archives/31


He says -
One abnormal behaviour with this light is that it will stay triggered if the ESP8266 radio is on, the solution is to put it into deep sleep with the radio off after the message is sent.


But that doesn´t work - I think the deep sleep is not working.
Could you help me understand this?

My Code:

Code: Select all/*
 *  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>
extern "C" {
  #include "user_interface.h"
}

const char* ssid     = "ESSID";
const char* password = "PASSWD";

const char* host = "HOMEPAGE";
const char* privateKey = "CODE";
const int buttonPin = 2;
int value;
int buttonstate;

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

  // We start by connecting to a WiFi network
  pinMode(buttonPin, INPUT);
  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());
}



void loop() {

delay(1000);

      Serial.println("Aenderung");
      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 = "/";
      url += "?id=";
      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");

system_deep_sleep_set_option(4);
system_deep_sleep(60000000);

   
 //ESP.deepSleep(50000, WAKE_RF_DISABLED);
 
}


greetigs from south germany.