[Solved]Rst cause:2, boot mode:(3,6)

Hello, Im trying to upload this sketch to ESP8266. Get Json data, and print to LCD display but, it doesnt work as the sketch. It just loop printing in serial monitor rst cause 2, boot mode (3,6)

The things I have tried
1, Tools> Erase flash> Erase all flash contents
2, Attempted uploading sketch not plugging any device.
3. Used different cable.

Actually, I could upload the sketch properly yesterday, but LCD didn`t work.
Do you have any solutions???

</>整形済みテキスト
#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
#include <WiFiClient.h>

#include <ArduinoJson.h>
#include <stdio.h>

#include <Wire.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27, 5, 4);

const char* ssid = "secret";
const char* password = "secret2";

const String endpoint = "http://api.openweathermap.org/data/2.5/weather?q=chiba,jp&APPID=";
const String key = "e8b6ba7b9f80d5870b70b44a9c08da2d";

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

// Initiate the LCD:
lcd.begin(16, 2);

int cursorPosition = 0;
lcd.setCursor(0, 0);
lcd.print(" Connecting");
Serial.println("Connecting");

WiFi.begin(ssid, password);

while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.println("Connecting to WiFi..");
lcd.setCursor(0, 2);
lcd.print(".");
cursorPosition++;
}
lcd.clear();
lcd.print(" Connected!");
Serial.println("Connected to the WiFi network");
delay(8000);
}

void loop() {
if ((WiFi.status() == WL_CONNECTED)) {
WiFiClient client;
HTTPClient http;
http.begin(client, endpoint + key); //URLを指定
int httpCode = http.GET(); //GETリクエストを送信

if (httpCode > 0) { //返答がある場合

  String payload = http.getString();  //返答(JSON形式)を取得
  Serial.println(httpCode);
  Serial.println(payload);
  const size_t capacity = JSON_ARRAY_SIZE(1) + JSON_OBJECT_SIZE(1) + JSON_OBJECT_SIZE(2) + JSON_OBJECT_SIZE(3) + JSON_OBJECT_SIZE(4) + JSON_OBJECT_SIZE(5) + JSON_OBJECT_SIZE(8) + JSON_OBJECT_SIZE(13) + 470;
  DynamicJsonBuffer jsonBuffer(capacity);
  String json = payload;

  //jsonオブジェクトの作成


  JsonObject& weatherdata = jsonBuffer.parseObject(json);

  //パースが成功したかどうかを確認
  if (!weatherdata.success()) {
    Serial.println("parseObject() failed");
  }

  //各データを抜き出し
  const char* weather = weatherdata["weather"][0]["main"];
  const double temp = weatherdata["main"]["temp"];

  //LCDに表示
  //画面を消去
  //天気を表示
  lcd.setCursor(0, 0);
  lcd.print(weather);
  //気温を表示
  lcd.setCursor(0, 1);
  String temp_str = String(temp - 273.15) + "°C";
  lcd.print(temp_str);
  Serial.println(weather);
  Serial.println(temp_str);
}

else {
  Serial.println("Error on HTTP request");
}

http.end(); //Free the resources

}
delay(5000);
}

</>整形済みテキスト

Hi rabbit,

please re-edit your post using the pencil-button.
You should post code by using code-tags
There is an automatic function for doing this in the Arduino-IDE
just three steps

  1. press Ctrl-T for autoformatting your code
  2. do a rightclick with the mouse and choose "copy for forum"
  3. paste clipboard into write-window of a posting

A picture of your error-message in an angle is hard to read
you can mark, copy & paste the messages from the serial monitor in a code-section too
click into the serial monitor
press Ctrl-A to mark all
press Ctrl-C to copy the marked into the clipboard
change to the posting
click the </>-Button
press Ctrl-V to paste the clipboard-content into a code-section

You should add serial-debug-output to narrow down at which place in your code the exception occurs
starting right behind the serial.begin

void setup() {
Serial.begin(115200);
Serial.println("Setup-Start");

and then add a Serial.println("describing text"); after each command

Additionally There is an exception-decoder plugin for the Arduino-IDE
install this exception-decoder this will help to find the place

best regards Stefan

Hi @rabbit787.

The problem you are having is caused by the very large delays.

line 43 -- > delay(8000);
line 95 --> delay(5000);

Either make the delays very low, (delay(100);), or try using this method
before each delay. --> yield();

RV mineirin

Thanks guys

it worked when I changed the lcd display library and reduce the delay

Seriously? A picture of a laptop screen? I can't thing of anything more useless for assisting people in helping you.

Please use COPY / PASTE and CODE TAGS ( </> ) to post your screenshot NOT a picture that is badly out of focus as nobody can read that.